HTML and CSS Reference
In-Depth Information
This method, however, is unreliable in a number of ways. First of all, a browser can
fake a UA string, which is the value that the browser-sniffing technique looks at to
determine the browser in use. Additionally, users can switch off certain features of their
browsers, so that even if you can determine the correct browser, you still can't be sure
which features are supported.
Also, if the user is running a new browser, a newer version of a browser, or an alternative
browser that you may not have bothered to check for, your code may fail to recognize
it altogether. Not to mention that it falls on your shoulders to be on top of what browsers
support which features.
Modernizr avoids these pitfalls, as it detects specifically which features are supported,
rather than merely trying to detect what browser the user is viewing the page through.
This is a far more reliable method if you want fine-tuned control over the user's
experience of your website.
Modernizr now supports a “production” version (see http://www.mod
ernizr.com/download/ ) . This version generates a custom build of Mod-
ernizr with only the HTML5 tests needed for your sites or web
applications.
See Also
The documentation on the official Modernizr website at http://www.modernizr.com/
docs/ .
2.6 Using HTML5 Boilerplate
Problem
You want to get up and running with HTML5 with a robust working template.
Solution
Use Paul Irish's HTML5 Boilerplate (as shown in Figure 2-7 ) as a jumping-off point for
your website. Not only does it include an HTML5 template complete with an organized
folder structure and CSS file, but it also incorporates current coding best practices,
browser bug fixes, and popular JavaScript libraries.
 
Search WWH ::




Custom Search