1.

How to detect whether a browser supports a particular feature using the Modernizr library. 

Answer»

Modernizr is an open source, MIT-licensed JavaScript library that DETECTS SUPPORT for many HTML5 & CSS3 features. You should ALWAYS use the latest version. To use it, include the following highlighted <script> element at the top of your PAGE.

<!DOCTYPE html> <html> <HEAD>  <meta charset="utf-8">  <title>Dive Into HTML5</title>   <script src="modernizr.min.js"></script> </head> <body></body> </html>

Following are the Apis supported by Modernizr

  • Modernizr.canvas attribute is used to detect support for the canvas API. 
  • Modernizr.canvastext attribute is used to detect support for the canvas text API.
  • Modernizr.video attribute is used to detect support for HTML5 video. 
  • Modernizr.localstorage attribute is used to detect support for HTML5 local storage. 
  • Modernizr.webworkers attribute is used to detect support for web workers.
  • Modernizr.applicationcache is used to detect support for offline web applications.
  • Modernizr.geolocation is used to detect support for the geolocation API.


Discussion

No Comment Found