[Javascript] link to external .css file based on browser detect

Jonathan Lane pcassist at bellsouth.net
Fri Jun 1 17:11:39 CDT 2001


Is it possible (how) to link to a different external stylesheet based on a
browswer detect?

I tried this simplified example, in this case intended to only apply the css
info IF browser is MSIE 4 or later:

....

<script language="JavaScript">
<!--
if (navigator.appName == "Microsoft" && navigator.appVersion >=4) {
document.write ('<link rel="stylesheet" href="cssDemo1.css"
type="text/css">');
}
//-->
</script>
</head>






More information about the Javascript mailing list