方法一,
<!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>
(完)