HTML 5 测试新元素

标签 html

如何测试我的浏览器是否支持新的语义 HTML 5 元素,例如:

<nav>
<footer>

等等?

最佳答案

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

还有,还有

Modernizr, an open source, MIT-licensed JavaScript library that detects support for many HTML5 & CSS3 features.

加上:

Appendix A: The All-In-One Almost-Alphabetical No-Bullshit Guide to Detecting Everything.

关于HTML 5 测试新元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2839272/

相关文章:

javascript - 无法触发jquery中的onclick事件

html - 如何在 HTML 中创建下载该文件的链接

javascript - 单击子 div 时如何关闭父 div 功能,当我再次单击父 div 时,该功能将激活

javascript - 移动浏览器+在焦点时删除输入字段值文本突出显示?

javascript - var myvalue = window.opener.document.getElementById (“parentId1” ) 不工作

PHP fseek 与远程视频或替代方案

html - Firefox 可以显示 JP2 图像吗?

javascript - 更改语言后更改文本对齐

html - 使按钮响应并水平居中

java - JLabel 在显示 HTML 时垂直向下移动文本