Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML 5 test for new elements

Tags:

html

How can I test if my browser supports the new semantic HTML 5 elements like:

<nav>
<footer>

and so on?

like image 657
xdevel2000 Avatar asked Mar 09 '26 10:03

xdevel2000


2 Answers

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:

  1. Check if a certain property exists on a global object (such as window or navigator).

    Example: testing for geolocation support

  2. Create an element, then check if a certain property exists on that element.

    Example: testing for canvas support

  3. Create an element, check if a certain method exists on that element, then call the method and check the value it returns.

    Example: testing which video formats are supported

  4. Create an element, set a property to a certain value, then check if the property retained its value.

    Example: testing which <input> types are supported

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.

like image 57
ax. Avatar answered Mar 11 '26 07:03

ax.


For a quick, non-programming check: The HTML5 Test

like image 29
Rob Avatar answered Mar 11 '26 07:03

Rob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!