我的网页上有“使用嵌入”标签。它正在工作,但全屏模式不起作用。
<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/embedAttributes
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/