文章详细
JS判断浏览器是否支持HTML5
 2013/12/25 22:13:01 评论:0人 阅读次数:9634

方法一,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>html5判断1</title>
</head>

<body>
<script>   
function checkhHtml5() {
	if (typeof(Worker) !== "undefined") {
		alert("支持HTML5");
	}
	 else {
		 alert("不支持HTML5");
	}
}
checkhHtml5();
</script>  
</body>
</html>

方法二,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>html5判断2</title>
</head>

<body>
<div id="Canvas"></div>
<script>   
if (!document.getElementById("Canvas").getContext) {  
	alert("支持html5");  
}  
else{  
	alert("不支持html5");  
}  
</script>  
</body>
</html>

(完)

如需转载请注明出处:http://www.86y.org/art_detail.aspx?id=663【JS判断浏览器是否支持HTML5】幸凡学习网
0
 
相关文章
推荐文章
Created By Charry-May 3,2010
粤ICP备10093478号-1
顶部