Question

Theoretically, could you detect if a browser supports HTML5 and prompt the visitor to upgrade to IE9/Firefox/Chrome/Safari/Opera if it doesn't support some features like CSS3 or audio/video tags?

I'm developing a hobby music site in a mostly walled-garden and would like to prevent people with anitquated browsers from accessing/logging into the site.

Mass appeal is not a requirement as the site is for a niche and maximizes JavaScript and HTML5 use.

Was it helpful?

Solution

I'd suggest using the modernizr javascript api to detect the HTML5 features you desire.

http://www.modernizr.com/

OTHER TIPS

You can use a conditional comment to show a warning to IE non-browsers:

<!--[if lt IE 9]> Get out of here! <![endif]-->

(You can also include a <script> tag that redirects to an upgrade page)

Well, theoretically, yes you could. However, it would really be a pain and not at all foolproof as it would likely rely upon javascript for implementation which could easily be circumvented.

Also, in practice, just about any user agent parameter can be spoofed, so you really couldn't rely upon user agent parameter detection to determine whether or not a user agent actually supports a specific tag.

Modernizr may be a good starting point for you, in the case of detecting HTML5 video.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top