Helpful Information
Category: HTML & CSS
Different external css for NS4

This is prolly a JS question, though here goes anyway:

How do I detect NS4 and make it use a different external stylesheet? is it just something like:

<link href="main.css" rel="styleSheet" type="text/css">
if (document.layers)
document.location = "ns4.css"

or similar? I hate accounting for NS4, though it won't support css background effects like no-repeat etc. If I can just shunt it to a different stylesheet all will be right with the world :). I can't get this to work for some reason. Do I need an 'else' statement?

Detection can become a waste of time in certain scenarios, especially when there are simpler methods...

the @IMPORT option will make this easier for you, since NS4 does not recognize it, but virtually all other browsers do, so browsers other than NS4 will pull in the second stylesheet with the more advanced stuff, while NS4 will only see a slimmed down stylesheet (and only one).

<link rel="stylesheet" type="text/css" href="/path/to.css">
<style type="text/css">
@import url(/path/toadv.css);

That is quite a bit easier, isn't it? :) Thanks Feyd.

Okay, I'm getting curious now as to what other uses the @import url statement has. Could you please point me to a reference for it? I bet it's good for a lot of things.


Nevermind. Went through the W3 CSS reference ( and apparently this is all it does. Is this yet another case of W3C finding different statements to do things browsers already do? Regardless, glad it works in this instance. :)

privacy (GDPR)