Before you go ahead and use any of the features of HTML5, it is recommended to verify that whether that particular feature is supported by target browser or not. You can verify supported feature using open source java script file ModernIZR

ModernIZR is open source java script file allows you to detect whether particular feature of HTML is supported on the target device or browser or not. You can download java script file from here.

To use it download js file and add it as script source in the header.

Below code snippet will verify whether video tag of HTML 5 is supported in browser or not.


<!DOCTYPE html >
<html>
<head>
<title>
Demo
</title>
<script src=modernizr-latest.js ></script>
<script>
alert(Modernizr.video);
</script>
</head>
<body>
<h1>debugmode</h1>
</body>
</html>


If you run above code snippet on IE9 you should get True as alert whereas on IE8 you should be getting False as alert.

Advertisements

One thought on “Learning HTML 5: Detecting HTML5 feature supported in browser using ModernIZR

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s