How can I test if my browser supports the new semantic HTML 5 elements like:
<nav>
<footer>
and so on?
How can I test if my browser supports the new semantic HTML 5 elements like:
<nav>
<footer>
and so on?
Dive Into HTML5 > Detecting HTML5 Features:
There are four basic techniques for detecting whether a browser supports a particular feature. From simplest to most complex:
Check if a certain property exists on a global object (such as window or navigator).
Example: testing for geolocation support
Create an element, then check if a certain property exists on that element.
Example: testing for canvas support
Create an element, check if a certain method exists on that element, then call the method and check the value it returns.
Create an element, set a property to a certain value, then check if the property retained its value.
Also, there is
Modernizr, an open source, MIT-licensed JavaScript library that detects support for many HTML5 & CSS3 features.
Plus:
Appendix A: The All-In-One Almost-Alphabetical No-Bullshit Guide to Detecting Everything.
If you want to make IE recognize the new semantic elements of HTML5, etc., this script will do that.