Grow your CSS skills. Land your dream job.

if ie -> if win howto

  • # July 15, 2009 at 1:07 pm

    Hi

    I know that there’s this html code:

    <!–[if IE]>
    Hi, you’re using ie!
    <![endif]–>

    But is there an html code "when using windows"? Like the previous code only say’s:

    "Hi, you’re using ie!"

    when the visitor is browsing under ie, But is there a code that say’s something when browsing under windows? e.g.: [sorry for the example :D ]

    <!–[if windows]>
    Hi, you’re using windows!
    <![endif]–>

    Thank you!!

    # July 15, 2009 at 1:13 pm

    There should never be big enough differences between Windows and OS X to need to have separate style sheets, but here’s some JS that says it does it (no idea how old it is):

    http://www.netobjects.com/workbench/js_css.html

    # July 15, 2009 at 1:29 pm

    I tried the second script on this page:

    http://www.netobjects.com/workbench/js_css.html

    but under windows (firefox), under Debian (iceweasel) it gives the following (the same):

    document.writeln(“”) } else { document.writeln(“”) }

    # July 15, 2009 at 1:58 pm

    Like I said, I have no idea how old the code is, nor if it actually works.

    I will repeat though, there should be no reason that you will need different style sheets depending on the operating system. Why do you need to do this?

    # July 15, 2009 at 2:04 pm

    It cant be done with html alone but you could use something like this:

    Code:
    < ?php
    echo $_SERVER['HTTP_USER_AGENT'];
    ?>

    and then use some sort of if statement to target windows users.

    # July 15, 2009 at 2:20 pm

    I checked:
    http://www.netobjects.com/workbench/js_css.html
    http://www.java2s.com/Tutorial/JavaScri … atform.htm
    http://www.javascripter.com/faq/operatin.htm
    http://www.web-wise-wizard.com/javascri … ation.html

    Ok, so there could be a way… :D

    Can anyone write a javascript, that would check the "navigator.platform" for string "win"? But making it lowercase before checking :D (so that it would surely find windows os :D )

    I only want to show this to the visitor, when browsing under windows (not a text :D ):

    <div align="center"><font size=4><table width="100%"><tr><td>under windows</td></tr></table></font></div>

    thank you :D

    # July 15, 2009 at 2:47 pm

    Assuming that the user hasn’t disabled javascript.

    # July 15, 2009 at 2:47 pm

    I’m trying, but it still doesn’t work :D

    <html>
    <head>
    </head>
    <body>
    <script language="JavaScript">

    if (navigator.platform.toLowerCase().indexOf(“win”)!=-1)
    {
    <div align="center"><font size=4><table width="100%"><tr><td>under windows</td></tr></table></font></div>
    }

    </script>
    </body>
    </html>

    # July 15, 2009 at 5:56 pm

    http://scriptasylum.com/tutorials/encde … ecode.html

    <html>
    <head>
    <title>
    </title>
    </head>
    <body>
    <script language="JavaScript" type="text/javascript">

    if (navigator.platform.toLowerCase().indexOf("win")!=-1)

    {
    document.write(navigator.platform.toLowerCase());
    document.write( unescape( ‘%3C%62%72%20%2F%3E’ ) );
    document.write( unescape( ‘%3C%66%6F%6E%74%20%73%69%7A%65%3D%34%3E%3C%74%61%62%6C%65%20%77%69%64%74%68%3D%22%31%30%30%25%22%20%62%67%63%6F%6C%6F%72%3D%22%23%65%65%65%65%65%65%22%3E%3C%74%72%20%2F%3E%3C%74%64%20%2F%3E%79%6F%75%27%72%65%20%75%73%69%6E%67%20%77%69%6E%64%6F%77%73%3C%74%64%20%2F%3E%3C%74%72%20%2F%3E%3C%74%61%62%6C%65%20%2F%3E%3C%66%6F%6E%74%20%2F%3E’ ) );
    }

    </script>
    </body>
    </html>

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".