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

Peter Brunone peter at brunone.com
Fri Jun 1 17:25:40 CDT 2001


    Just for the record, this is really easy to do if you use a server-side
scripting technology like ASP, PHP, or CGI.  Perhaps you should look into
what's available for your particular server.

----- Original Message -----
From: "Jonathan Lane" <pcassist at bellsouth.net>
To: <javascript at LaTech.edu>
Sent: Friday, June 01, 2001 5:11 PM
Subject: [Javascript] link to external .css file based on browser detect


> 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>
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
>





More information about the Javascript mailing list