Results 1 to 4 of 4

Thread: CSS specifically for Windows XP

  1. #1
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default CSS specifically for Windows XP

    I want to create a separate stylesheet for users running Windows XP. Is there a way to do it? I just want to assign a different font family to Windows XP users. I have seen codes in which you have different stylesheet for OSX and Windows. But I would like it to be Win XP only. I tried looking around the web but couldn't find anything on it.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You can check the user agent string to see if it contains windows xp or just xp or some variation. Look for a few examples of such user agent strings then work from there bit won't be completely reliable but this is not a fundamental requirement so it should be ok.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Bad idea. Why would you want to do this? Like you know how a particular font is gonna look on every machine in the world that's running XP. I think not!

    Design your site to look OK in any browser or OS, only use a fudge if absolutely required, and then base it upon a browser's self identified capabilities, not upon some report from the navigator object.

    That said, here's a link to a navigator object tool I wrote that will show you what you get:

    http://home.comcast.net/~jscheuer1/side/nav_obj/

    Everything in the property column can be got as:

    Code:
    navigator.property
    So you could do like:

    Code:
    alert(navigator.userAgent);
    to get the string. Or (looks like from here this may work):

    Code:
    <script type="text/javascript">
    var osVer = /^.*Windows NT (\d\.\d+).*/.exec(navigator.userAgent);
    if(osVer && osVer[1] < 6 && osVer[1] > 5.09){
    	do whatever;
    }
    </script>
    It looks for 'Windows NT #.#' and pulls the number for testing if its there. According to:

    http://msdn.microsoft.com/en-us/libr...spx#UATokenRef

    Testing the range to be between 5.09 and 6 will get you

    Windows Server 2003; Windows XP x64 Edition; Windows XP
    all presumably XP or XP-ish.

    But - Be aware, the default for XP is Clear Type off, though I would think most folks have turned it on by now. You cannot control or determine this. It will change most any font's appearance. And various browsers will render things differently even on the same XP machine using the same font. And the font you want might not be available on a given XP system and/or given browser on that system.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. The Following User Says Thank You to jscheuer1 For This Useful Post:

    fase_xi (02-02-2011)

  5. #4
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thanks. Just found some time to try it. That's pretty much what I was looking for.

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
  •