[thelist] Browser Sniffing
Peter-Paul Koch
gassinaumasis at hotmail.com
Wed Jan 23 16:02:23 CST 2002
>On my web site, I use "browser sniffing" code (in JavaScript) to direct
>users depending on browser type and version. Instead of redirection, I
>would like to download the appropriate JS and CSS files after detecting
>the browser version and type, and keep the user at the main index page.
<PEEVE TYPE="pet">
DON'T use a browser detect for JS redirecting. If you want to know if a
certain JS method or property works in a browser, check if the object
exists. This way your code will also run effortlessly in the minor browsers
like Opera and Konqueror who are usually left out of browser detects but can
sometimes perfectly execute your code, if you let them.
See http://www.xs4all.nl/~ppk/js/index.html?support.html for more
information. (Yes, I'm once again pushing my own site but I find it very
important for beginning scripters to understand this particular issue).
</PEEVE>
As to multiple CSS, I don't like them either, but I can imagine it's
sometimes necessary.
>If this possible can anyone suggest where I could find some hints as to how
>to write the code?
http://www.xs4all.nl/~ppk/js/index.html?detect.html
ppk
_________________________________________________________________
Join the worlds largest e-mail service with MSN Hotmail.
http://www.hotmail.com
More information about the thelist
mailing list