我知道 <video>
标记在 Internet Explorer 8 中不能正常工作,但这没关系。我想要做的是,如果用户尝试使用 IE8 打开链接,显示一条错误消息,类似 you're using browser XX and it's not supported
.
我试过这个:
<video id="ivideo" src="skins/Sandbox_Light/styleVideos/anima.mp4" controls onended="ivideo();" style="width:952px; height=435px" autoplay="autoplay">
Not supported by your browser
</video>
然而,我看到的却是黑色 div
中间有一个 X,好像问题出在缺少插件。我试着打开 this page在 IE9 中运行良好。
最佳答案
使用这段代码进行特征检测:
function supports_video() {
return !!document.createElement('video').canPlayType;
}
由 dive into html5 提供:http://diveintohtml5.info/detect.html
关于Internet Explorer 8 中的 HTML5 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10418593/