简体   繁体   English

Internet Explorer 8中的HTML5视频

[英]HTML5 video in Internet Explorer 8

I know that the <video> tag doesn't work well in Internet Explorer 8, and that's fine. 我知道<video>标记在Internet Explorer 8中不能很好地工作,这很好。 What I want to do is, if the user tries to open the link with IE8, display an error saying something like you're using browser XX and it's not supported . 我想做的是,如果用户尝试使用IE8打开链接,则显示一条错误消息,提示you're using browser XX and it's not supported

I tried this: 我尝试了这个:

<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>

However, instead I see a black div with an X in the middle, as if the problem was from the plugin missing. 但是,相反,我看到一个中间有X的黑色div ,好像问题出在插件中。 I tried to open this page and it works fine in IE9. 我试图打开此页面 ,它在IE9中工作正常。

Use this piece of code to feature detect it: 使用这段代码来检测它:

function supports_video() {
    return !!document.createElement('video').canPlayType;
}

Courtesy of dive into html5: http://diveintohtml5.info/detect.html 感谢深入HTML5: http : //diveintohtml5.info/detect.html

Check out the ie6 blocker script in the link below. 在下面的链接中查看ie6阻止脚本。

Place this in a seperate file that loads the html 5 将此放置在加载html 5的单独文件中

<!--[if <= IE 8]>
    <script type="text/javascript" src="jquery.ie6blocker.js"></script> 
<![endif]-->

    <video id="ivideo" src="skins/Sandbox_Light/styleVideos/anima.mp4" controls onended="ivideo();" style="width:952px; height=435px" autoplay="autoplay">

Then load the video through an iframe. 然后通过iframe加载视频。 I would recomend editing the script to justify what you are doing if needed.. also change the size of the image. 我建议编辑脚本以证明您在做什么,如果需要的话..还可以更改图像的大小。 Also, put a link to upgrade browser. 另外,放置一个链接以升级浏览器。

http://css-tricks.com/ie-6-blocker-script/ http://css-tricks.com/ie-6-blocker-script/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM