检查浏览器是否支持HTML5 [英] Check if a browser supports HTML5

查看:129
本文介绍了检查浏览器是否支持HTML5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用任何编程/脚本语言检查是否支持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.

推荐答案

这听起来很艰巨,因为现有的浏览器都不完全支持HTML5.有一些在支持HTML5子集方面做得更好.此页面上有一个检查( HTML5测试 [ ^ ]),可以使您了解要进行哪些检查,但是此页面并不要求完整性.一页显示您的浏览器的评分方式,另一页显示其他浏览器的评分作为比较.

干杯!

修改:

在这里,您会在GIT上找到一个"HTML5测试页"项目. index.html文件特别有趣: https://github.com/NielsLeenheer/html5test/blob/master /index.html [ ^ ]
This is sounds like a very tough job as none of the existing browsers fully support HTML5. There are ones doing better at supporting a subset of HTML5 than others. There is a check on this page (HTML5 Test[^]) that gives you an idea what checks to integrate, but this page doesn''t claim completeness. One page shows how your browser is scoring and second one shows the scores of other browsers as a comparison.

Cheers!

Modification:

Here you''ll find a "HTML5 Testpage" project on GIT. The index.html file is especially interesting: https://github.com/NielsLeenheer/html5test/blob/master/index.html[^]



更好的解决方案是使用诸如Modernizr(http://www.modernizr.com/)之类的功能在客户端上进行功能检测.Modernizr是一个开放的,MIT许可的JavaScript库,用于检测对许多HTML5和Java的支持. ; CSS3功能.
Hi,
The better solution is to use something like Modernizr (http://www.modernizr.com/) to do your feature detection on the client-side.Modernizr is an open source, MIT-licensed JavaScript library that detects support for many HTML5 & CSS3 features.
If your browser does not support the canvas API, the Modernizr.canvas property will be false.
<script >

if (Modernizr.canvas) {
  // let&#39;s draw some shapes!
} else {
  // no native canvas support available :(
}</script >



参考: http://diveintohtml5.info/detect.html [



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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆