问题描述
如何使用任何编程/脚本语言检查是否支持HTML5的浏览器?
提前谢谢!
修改:
通过以下给出的帖子/答案,我发现了支持HTML 5的最佳浏览器是什么
浏览器分数:(在我的计算机中)
Mozilla Firefox 3.6.13 = 155和04奖励积分
Opera 11.01 = 234和07奖励积分
Google Chrome = 282和13奖励积分
Safari = 228和07奖励积分
有人可以告诉我如何获取信息,甚至可以只是检查浏览器是否支持某些HTML5.
如果有人可以发布代码,我将不胜感激.
How can I check if a browser that supports HTML5 by using any programming/scripting language?
Thanks in advance!
Modification:
With the below given posts/answers, I found out what the best Browser is that supports HTML 5
Browser Scores: (this is in my computer)
Mozilla Firefox 3.6.13 = 155 and 04 bonus points
Opera 11.01 = 234 and 07 bonus points
Google Chrome = 282 and 13 bonus points
Safari = 228 and 07 bonus points
Can someone show me how to get or even just check if the browser can support some HTML 5.
I''d totally appreciate if someone can post a code.
推荐答案
If your browser does not support the canvas API, the Modernizr.canvas property will be false.
<script >
if (Modernizr.canvas) {
// let's draw some shapes!
} else {
// no native canvas support available :(
}</script >
参考: http://diveintohtml5.info/detect.html [ ^ ]
如果使用的是JQuery,则为另一种解决方案:
检查对HTML 5的canvas元素的支持
Ref:http://diveintohtml5.info/detect.html[^]
Another solution if you are using JQuery:
Checking for support for the canvas element of HTML 5
var test_canvas = document.createElement("canvas") //try and create sample canvas element
var canvascheck=(test_canvas.getContext)? true : false //check if object supports getContext() method, a method of the canvas element
alert(canvascheck) //alerts true if browser supports canvas element
参考: http://www.javascriptkit.com/javatutors/createelementcheck.shtml [ ^ ]
Ref:http://www.javascriptkit.com/javatutors/createelementcheck.shtml[^]
这篇关于检查浏览器是否支持HTML5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!