Learning HTML 5: Detecting HTML5 feature supported in browser using ModernIZR

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.
Ebook Download
View all
Learn
View all