Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect HTML 5 compatibility in browser

Tags:

What is the best way to detect browser compatibility for HTML 5 syntax? And prompt the user if the browser is not compatible?

I understand the tutorial which shows how to test browser compatibility for HTML5. But I am curious to know if that is the only way? Do I need to inspect each and every element?

like image 314
Chris Avatar asked Jul 18 '11 10:07

Chris


People also ask

How do I know my browser support HTML5?

The getContext method is checked by accessing it on the created input object. The result of this expression is checked with an if-statement. If the result is true, it means that HTML5 is supported by the browser.

What is the recommended method to detect browser compatibility for features HTML5?

For determining at run-time whether the user's browser supports a given feature, you can use Modernizr. This is a Javascript-based tool which will give you a set of CSS classes and Javascript flags which tell you what features are supported.

How do I know HTML5?

If a page uses the HTML5 doctype (<! DOCTYPE html>) , you can determine it as a html5.


1 Answers

Have a look at Modernizr:

Taking advantage of the new capabilities of HTML5 and CSS3 can mean sacrificing control over the experience in older browsers. Modernizr 2 is your starting point for making the best websites and applications that work exactly right no matter what browser or device your visitors use.

Thanks to the new Media Query tests and built-in YepNope.js micro-library as Modernizr.load(), you can now combine feature detection with media queries and conditional resource loading. That gives you the power and flexibility to optimize for every circumstance.

It has a lot of built in methods to test for browser features and provides a useful way of providing fallback code for when features you want to use are not supported.

More info: http://www.modernizr.com/

like image 93
betamax Avatar answered Oct 01 '22 03:10

betamax