Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Closed Thread
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-15-2002, 09:42 AM   PM User | #1
jscript_junkie
New Coder

 
Join Date: Jun 2002
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
jscript_junkie is an unknown quantity at this point
Internet Explorer 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.
jscript_junkie is offline  
Old 06-15-2002, 09:54 AM   PM User | #2
redhead
Regular Coder

 
Join Date: Jun 2002
Location: United Kingdom Confused: Often
Posts: 859
Thanks: 0
Thanked 0 Times in 0 Posts
redhead is an unknown quantity at this point
I would use conditional comments, its simple:

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

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

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
__________________
redhead
redhead is offline  
Old 06-15-2002, 09:58 AM   PM User | #3
jscript_junkie
New Coder

 
Join Date: Jun 2002
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
jscript_junkie is an unknown quantity at this point
Thanks

Thanks. I'll try reading that tutorial. If anything happens, I'll post a question here.
jscript_junkie is offline  
Old 06-15-2002, 10:43 AM   PM User | #4
jscript_junkie
New Coder

 
Join Date: Jun 2002
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
jscript_junkie is an unknown quantity at this point
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">"
jscript_junkie is offline  
Old 06-15-2002, 11:04 AM   PM User | #5
redhead
Regular Coder

 
Join Date: Jun 2002
Location: United Kingdom Confused: Often
Posts: 859
Thanks: 0
Thanked 0 Times in 0 Posts
redhead is an unknown quantity at this point
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
<![endif]-->

<![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
<![endif]>

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]>

apoligies!
__________________
redhead

Last edited by redhead; 06-15-2002 at 11:08 AM..
redhead is offline  
Old 06-15-2002, 11:09 AM   PM User | #6
jscript_junkie
New Coder

 
Join Date: Jun 2002
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
jscript_junkie is an unknown quantity at this point
Thanks

Oh, I see now. Thanks for your help.
jscript_junkie is offline  
Old 06-15-2002, 11:18 AM   PM User | #7
redhead
Regular Coder

 
Join Date: Jun 2002
Location: United Kingdom Confused: Often
Posts: 859
Thanks: 0
Thanked 0 Times in 0 Posts
redhead is an unknown quantity at this point
any time
redhead is offline  
Old 06-15-2002, 03:45 PM   PM User | #8
Zvona
Regular Coder

 
Join Date: May 2002
Location: Helsinki, Finland
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Zvona is an unknown quantity at this point
Thumbs down

I don't want to be mean since beginning, but jscript_junkie, you should read rules about cross-posting (Referring to this post).
__________________
Zvona
First Aid for
Web Design
Zvona is offline  
Old 06-19-2002, 06:28 PM   PM User | #9
Sc00bs
New to the CF scene

 
Join Date: Jun 2002
Location: Kent, UK
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Sc00bs is an unknown quantity at this point
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
Sc00bs is offline  
Closed Thread

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:36 AM.


Advertisement
Log in to turn off these ads.