SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: text size

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    Dłn Éideann, Alba
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know of a method to detect the text size of the browser?

    Cheers. Scot-Bot.

  2. #2
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe this is possible with a server-side solution. I'd post in that section of the forums, and make sure you check here as well...

    Hope this helps.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  3. #3
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I don't think this is possible (whether server-side or client-side). There may be a method specified in the official DOM (i.e. by detecting the font-size setting of the current style sheet), but even if that is the case, the majority of current browsers would not support it.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  4. #4
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kevin: After some researching, I have to agree with you. Font styles / sizes are user specified. Perhaps with the browser capabilities component? Probably not, but it's the closest thing I can come up with (in ASP, anyway).
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  5. #5
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Even if you could do it it would be quite pointless really as I could change my text size whenever, so you would have to be continously checking!

    Also, text size is very relevant when it comes to accessibility so you ahve to be careful! What exactly were you planning to do?

  6. #6
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey guys,

    When you say "detect text size" what exactly do you mean. If I'm thinking of the correct thing, the best I could think of is define layers with different text sizes with CSS that won't change depending on the user's "text size." Then compare the widths of those layers with the width of a layer with text w/o any size defined (it'll use browser default).

    Just a thought,
    aDog

  7. #7
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    Dłn Éideann, Alba
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure i really need to do this anymore, guys. I was planning to dynamically position my DHTML menus according to the text size the user has their browser set to. So, if the text size of the navbar was set differently on a number of clients, the menus would automatically readjust their position. I wanted to do it this way rather than traditional event-handling because I wanted as much and as easily as possible to create a completely cross-browser solution, since all browsers seem to have their own methods of event-detection.

    However, I've since had to compromise and consequently returned to using event detection, instead. At least, in IE4+ i have. I've had trouble getting this to work in Nav and NS6, despite using their respective browser-object models. Anyway, I've managed to address this by passing a 'this' parameter when the user clicks the appropriate hyperlink on the navbar. This just find the x and y positions of the hyperlink and then draws the correct menu at the specified position. Not exactly ideal, but it works.

    Cheers. Scot-Bot.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •