Re: CSS, Javascript and Browser Detection
by Andrej Kostresevic <temporalassassin(at)yahoo.com>
|
Date: |
Mon, 4 Jun 2001 11:50:22 -0700 (PDT) |
To: |
Rick Jones <RJones(at)NAHRO.org>, "'hwg-style(at)hwg.org'" <hwg-style(at)hwg.org> |
In-Reply-To: |
COMM1 |
|
todo: View
Thread,
Original
|
|
This is one way of doing this. However, it limits you to serving only
browser compatible css, leaving html and javascript the same for all
visitors.
I took care of this issue once by doing browser and screen-size detection
server side(asp), and then using the corresponding XSLT
template/stylesheet to process the XML data that was the same for all
cases(per page).
I think this is the best way to approach this issue, provided you have the
time and resources.
This can also be done client-side, but works only for clients that support
XSLT.
Andrej
--- Rick Jones <RJones(at)NAHRO.org> wrote:
> 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
>
>
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
HWG hwg-style mailing list archives,
maintained by Webmasters @ IWA