在http://www.w3school.com.cn学习html5的时候,看到一个检测您的浏览器是否支持 HTML5 视频的方法: 运行效果: 1.在EditPlus中运行 2.在chrome浏览器中运行 ======================================================= 代码部分: ======================================================= 复制代码代码如下: <br /> function checkVideo()<br /> {<br /> if(!!document.createElement('video').canPlayType)<br /> {<br /> var vidTest=document.createElement("video");<br /> oggTest=vidTest.canPlayType('video/ogg; codecs="theora, vorbis"');<br /> if (!oggTest)<br /> {<br /> h264Test=vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');<br /> if (!h264Test)<br /> {<br /> document.getElementById("checkVideoResult").innerHTML="Sorry. No video support."<br /> }<br /> else<br /> {<br /> if (h264Test=="probably")<br /> {<br /> document.getElementById("checkVideoResult").innerHTML="Yes! Full support!";<br /> }<br /> else<br /> {<br /> document.getElementById("checkVideoResult").innerHTML="Well. Some support.";<br /> }<br /> }<br /> }<br /> else<br /> {<br /> if (oggTest=="probably")<br /> {<br /> document.getElementById("checkVideoResult").innerHTML="Yes! Full support!";<br /> }<br /> else<br /> {<br /> document.getElementById("checkVideoResult").innerHTML="Well. Some support.";<br /> }<br /> }<br /> }<br /> else<br /> {<br /> document.getElementById("checkVideoResult").innerHTML="Sorry. No video support."<br /> }<br /> }<br /> 检测您的浏览器是否支持 HTML5 视频: Check