Welcome Guest, Not a member yet? Register   Sign In
reliable (?) browser detection
#1

[eluser]richzilla[/eluser]
What is the best way to detect the browser that my users are using?

I have a small web app that uses css3 and html 5 and i want to show different pages for browsers that dont support this.

(btw, before anybody says anything, im aware that i should just have the same functionality on every page and it should gracefully degrade, but i have different reasons for showing non html5 compatible browsers a different page)
#2

[eluser]SitesByJoe[/eluser]
There's a huge number of options for browser detection, none of which are fool-proof by any means.

The newest version of browser sniffing has become "feature sniffing".

Check out modernizr: http://www.modernizr.com/

Any browser out there should re able to handle HTML5 without the new elements. (e.g. canvas)
#3

[eluser]cahva[/eluser]
Modernizr might be just for you Smile Instead of checking browser compatibility, it checks support for different features of CSS3 and HTML 5.
#4

[eluser]WanWizard[/eluser]
And that's the way to go. Never rely on browser detection.

All scripts that do that, and assume some code works for a specific browser, may have issues now that Microsoft has produced a browser (IE9) that doesn't suck so much.
I've already had to patch quite a bit of code (like bbcode or html editors) so that for IE9 the Mozilla route was taken, as the "if IE" route failed horribly.
#5

[eluser]CroNiX[/eluser]
And it only took 9 versions and 10+ years...lol

Also, never trust useragent, since you can change it to whatever you want...




Theme © iAndrew 2016 - Forum software by © MyBB