CSS, Javascript and Browser Detection
by Rick Jones <RJones(at)NAHRO.org>
|
| Date: |
Mon, 4 Jun 2001 12:15:16 -0400 |
| To: |
"'hwg-style(at)hwg.org'" <hwg-style(at)hwg.org> |
| |
todo: View
Thread,
Original
|
|
I'm thinking of using Javascript to detect what browser people are using so
I can serve them a CSS based on the browser of their
choice. What's your opinion on using this technique? Have you tried it?
Below is javascript code for TopStyle's minimalist approach to this. It
supposed to
detect whether the user is using IE or NN or Other.
Any recommendations? Does anyone have code that detects for more browser
versions? I feel like going nuts with CSS...
<!--
if(-1 != navigator.userAgent.indexOf("MSIE"))
{
// Internet Explorer
document.write('<link rel="stylesheet" type="text/css" href="ie.css">');
}
else if (-1 != navigator.userAgent.indexOf("Mozilla"))
{
// Netscape document.write('<link rel="stylesheet" type="text/css"
href="netscape.css">');
}
else
{
// other
document.write('<link rel="stylesheet" type="text/css" href="other.css">');
} //-->
Rick
Rick Jones
Online Information Manager
National Association of Housing and Redevelopment Officials (NAHRO)
http://www.nahro.org
630 Eye St. NW, Washington, DC 20001-3736
rjones(at)nahro.org
Toll Free (877) 866-2476 or (202) 289-3500 ext. 248
HWG hwg-style mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.