简体   繁体   English

浏览器不支持HTML5视频时,如何重定向到URL?

[英]How can I redirect to a URL when browser dose not support HTML5 videos?

I am trying to redirect to a different URL when html5 video's not supporting. html5视频不支持时,我试图重定向到其他URL。 Actually HTML5 video are not playing in safari browser. 实际上,HTML5视频无法在野生动物园浏览器中播放。 So I want to redirect my page to home.html instead of index.html. 所以我想将页面重定向到home.html而不是index.html。 Any help or direction My browser giving message Your browser does not support HTML5 video . 任何帮助或指示我的浏览器给Your browser does not support HTML5 video消息Your browser does not support HTML5 video Here is my code, any help will be appreciated. 这是我的代码,任何帮助将不胜感激。

index.html 的index.html

<video id="myVideo" autoplay preload controls >
    <source src="final.mp4" type="video/mp4">
    <source src="final.ogv" type="video/ogg; codecs=theora, vorbis">
    <source src="final.webm" type="video/webm; codecs=vp8, vorbis">
       Your browser does not support HTML5 video.
</video>

You can check if the video element is supported in JavaScript, and then redirect if it isn't supported: 您可以检查video元素是否受JavaScript支持,然后重定向(如果不支持):

if (!document.createElement('video').canPlayType) {
  window.location.replace('home.html');
}

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

相关问题 如何在不支持 HTML5 或 Flash 的任天堂 3ds 浏览器中播放视频? - How to play videos in nintendo 3ds browser which does not support HTML5 or flash? 如何检查浏览器是否支持HTML5文件上传(FormData对象)? - How can I check if the browser support HTML5 file upload (FormData object)? 如何在 Flex 中获得 HTML5 FileApi 支持? - How can I have HTML5 FileApi Support in Flex? 如何在不干扰原生控件的情况下为我的HTML5视频添加点击播放? - How can I add click-to-play to my HTML5 videos without interfering with native controls? 如何检查浏览器对HTML5表单属性的支持? - How to check browser support for HTML5 form attributes? 如何在IE浏览器中检测HTML5和CSS3支持? - how to detect HTML5 and CSS3 support in IE browser? 检测移动浏览器对HTML5支持的代码 - Code to detect mobile browser support for HTML5 HTML5历史记录:如何查看弹出的URL(即单击“后退”按钮时所处的页面) - HTML5 history: how can I see the URL that was popped (ie, the page we were on when we hit the back button) 我如何知道HTML5 Canvas何时完成绘图? - How can I know when HTML5 Canvas finished drawing? 如何在 HTML 视频结束后重定向到 URL? - How can I redirect to a URL after a HTML video has ended?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM