javascript - 嵌入式YouTube视频无法在全屏模式下运行

标签 javascript html jquery youtube

我的网页上有“使用嵌入”标签。它正在工作,但全屏模式不起作用。

<embed class="embed-responsive-item" src="https://www.youtube.com/embed/EngW7tLk6R8" allowfullscreen="true">

最佳答案

它被阻止的原因是因为它在embed标签中,为此尝试使用<iframe>:

<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/EngW7tLk6R8" allowfullscreen="true"></iframe>

<embed>标记不支持全屏模式,如下所示:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed
Attributes
This element's attributes include the global attributes.

height
The displayed height of the resource, in CSS pixels. This must be an absolute value; percentages are not allowed.
src
The URL of the resource being embedded.
type
The MIME type to use to select the plug-in to instantiate.
width
The displayed width of the resource, in CSS pixels. This must be an absolute value; percentages are not allowed.

这不包括allowfullscreen属性,而<iframe>包括。

关于javascript - 嵌入式YouTube视频无法在全屏模式下运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62339234/

相关文章:

c# - 使用 javascript 或 C# 在 PDF 上绘图

javascript - 如何使用 html 和 css 制作幻灯片

javascript - 对表格进行排序后,表格行中的替代行颜色不起作用

javascript - 单选组显示所选值的项目 jQuery

javascript - jQuery 获取所有没有分配 id 的元素

javascript - Angularjs模块工厂服务问题

javascript - Sourcemaps 不适用于 gulp 中的 CoffeeScript 和 Webpack

html - 为什么绝对定位的div不是从顶部开始的呢?

html - 如何在谷歌地图中指向多个地方

javascript - 如何限制用户应根据下拉响应为文本字段赋值?