Book Image

Mastering jQuery Mobile

Book Image

Mastering jQuery Mobile

Overview of this book

Table of Contents (17 chapters)
Mastering jQuery Mobile
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Feature detection with Modernizr


Not all browsers are created equal and neither is their support for many aspects of HTML5. How can we adequately account for that? A small JavaScript library named Modernizr, which can handle what's known as feature detection, comes to our rescue.

Modernizr is a powerful JavaScript library that will allow you to test the browser for specific features. If you want to make a very hip HTML5 web application and are worried about the current divide on the HTML5 standard implementation across the browsers, you should consider using this incredibly powerful library. With it, you can check to see whether the browser supports the canvas tag, for example, or whether it supports some of the new HTML5 form elements such as tel. You name it and more than likely Modernizr can test for it.

In this section, we'll use Modernizr to test a few different popular HTML5 elements that we may use in our Mobile jQuery project later in this book.

Getting started

First we will need to...