Web Analytics Made Easy -
StatCounter CSS Sniffing Out Question - CodingForum


No announcement yet.

CSS Sniffing Out Question

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

  • CSS Sniffing Out Question

    Hi everybody. I want a way to sniff out the IE 5.5+ users and provide them with "ie55.css" and everyone else with "other.css" I know I can put some document write in the format of "LINK rel="stylesheet"..." but I don't know how to make it so that only IE 5.5+ writes one LINK tag and all other browsers writing a different LINK tag. In a nutshell, IF IE 5.5+ write "<LINK rel="stylesheet" src="ie55.css" type="text/css">" else write "<LINK rel="stylesheet" src="other.css" type="text/css">"

    Hope that helps for a better description. Thanks.

  • #2
    I would use conditional comments, its simple:

    <!--[if gte IE 5.5000]>
    <link rel="stylesheet" src="ie55.css" type="text/css">

    <![if lt IE.5000]>
    <link rel="stylesheet" src="other.css" type="text/css">

    there is a tutorial on the JavaScript Kit site about these here, they are simple and to the point, without using huge chunks of code.

    Hope this helps


    • #3

      Thanks. I'll try reading that tutorial. If anything happens, I'll post a question here.


      • #4
        That is a really good tool

        This is a good tool for IE users, but I also need something to write a LINK tag if they are using something other than IE 5.5+ (Netscape users will need a script since the comments aren't supported) In another nutshell , IF other than IE 5.5+ write "<LINK rel="stylesheet" src="other.css" type="text/css">"


        • #5
          the whole way this works is that if it is "if greater than or equal to IE 5" it will be a comment, and IE will display it as if there was no comment. if its "if less than IE 5" then it will not be a comment, so all other browsers will take it as a blank/incorrect tag. (correct me if im wrong)

          heres what i mean...

          <!--[if gte IE 5]>
          this one is treated as a comment if its not IE5+, but IE5+ is programmed to display this stuff

          <![if lt IE 5]>
          this was never a comment to begin with, but IE5+ is programmed not to display it. All other browsers will display it because it isnt a comment

          see?... hope this helps, this method has always worked for me

          Edit: Whoops, i had made a mistake in my first post. the second conditional comment should have been:

          <![if lt IE 5.5000]>

          Last edited by redhead; Jun 15, 2002, 06:08 AM.


          • #6

            Oh, I see now. Thanks for your help.


            • #7
              any time


              • #8
                I don't want to be mean since beginning, but jscript_junkie, you should read rules about cross-posting (Referring to this post).
                First Aid for
                Web Design


                • #9
                  think you can do the ! = not thingamebob too
                  <!--[if gte IE 5]> (if greater than IE5)
                  <!--[if ! gte IE 5]> (if not greater)

                  That will make it less painful on those weary braincells after a long day