How can I display an image if browser does not support HTML5#39;s lt;videogt; tag(如果浏览器不支持 HTML5 的lt;videogt;,我如何显示图像?标签)
问题描述
有谁知道如何为不支持该标签的浏览器显示图像?显示文本,例如:
Does anyone know how can I display an image for the browsers which don't support the tag ? Displaying a text such as in:
<video src="dmlkZW8ubXA0" type="video/mp4">
Your browser does not support the <video> tag
</video>
很简单,但是如果我用 img 标签替换文本,它会始终显示图像,即使浏览器确实支持 video 标签.
Is easy, but if I replace the text with an img tag, it will always show the image, even when the browser DOES support the video tag.
感谢分享您的知识
(编辑)事实并非如此,我的测试是错误的,并且 img 标签确实只有在不支持视频时才会呈现(例如 Safari 5)
(EDIT) This is not the case, my tests were wrong and img tag indeed gets rendered only when video is not supported (e.g. Safari 5)
推荐答案
我只是在查看这个链接,以及HTML5 的规范,所以这段代码应该适合你:
I was just checking this link, as well as HTML5's spec, so this code should work for you:
<video controls="controls" poster="<your image poster if applicable>">
<source src="dmlkZW8ubXA0" type="video/mp4" />
<img src="Jmx0O3lvdXIgTm8gdmlkZW8gc3VwcG9ydCBpbWFnZSZndDs=" title="WW91ciBicm93c2VyIGRvZXMgbm90IHN1cHBvcnQgdGhlICZsdDt2aWRlbyZndDsgdGFn" />
</video>
这篇关于如果浏览器不支持 HTML5 的<video>,我如何显示图像?标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如果浏览器不支持 HTML5 的<video>,我如何显示图像?标签


- 400或500级别的HTTP响应 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01