【问题标题】:Embedded YouTube videos doesn't work fullscreen mode嵌入的 YouTube 视频在全屏模式下不起作用
【发布时间】:2020-10-01 23:21:41
【问题描述】:

我的网页使用了嵌入标签。它可以工作,但全屏模式不起作用。

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

【问题讨论】:

标签: javascript html jquery youtube


【解决方案1】:

它被阻止的原因是它在嵌入标签中,请尝试使用&lt;iframe&gt;

&lt;iframe class="embed-responsive-item" src="https://www.youtube.com/embed/EngW7tLk6R8" allowfullscreen="true"&gt;&lt;/iframe&gt;

&lt;embed&gt; 标签不支持全屏模式,如下所示: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 属性,而&lt;iframe&gt; 包括。

【讨论】:

  • 这是一个明显的重复,不需要给出答案,除非你要解释为什么 embed 不起作用而 iframe 是。
  • 很公平,我正在研究以找出为什么它不再工作的最佳答案。但由于我没有准备好那种答案,我想首先帮助 OP,让它发挥作用
  • 那么评论更合适:)
猜你喜欢
  • 2012-06-26
  • 2019-01-02
  • 2012-05-16
  • 2014-05-21
  • 1970-01-01
  • 2013-08-30
  • 1970-01-01
  • 2018-04-12
  • 2012-02-17
相关资源
最近更新 更多