我在网页上的嵌入 YouTube 链接在Safari上完美展示,但在Chrome上却没有!我不明白为什么。
以下是代码:
<iframe width="720" height="405" src="https://www.youtube.com/embed/lhYcUN60QjU?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
请指教!
答案 0 :(得分:0)
检查已安装的扩展程序和Chrome版本。你有Chrome的开发者版本吗?
点击并选择设置&gt;,尝试从Chrome中清除缓存显示高级设置&gt; 删除浏览数据。
另外,选中启用硬件加速时。
答案 1 :(得分:0)
从 https:// 切换到 http:// 。我在this Pen中使用Chrome浏览器(43.0.2357.134(64位))。
(我已将代码放在此处,因为编辑不会让我在没有代码的情况下引用Pen。代码用于响应<iframe>
。一般来看 How to make this youtube video responsive?。)
// CSS
.responsive-wrapper {
position: relative;
height: 0; /* gets height from padding-bottom */
/* put following styles (necessary for overflow and scrolling handling
on mobile devices) inline in .responsive-wrapper around iframe because not
stable in CSS:
-webkit-overflow-scrolling: touch; overflow: auto; */
}
.responsive-wrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#Iframe-YouTube-Life-Coach {
max-width: 100%;
max-height: 100%;
overflow: hidden;
}
/* padding-bottom = h/w as % -- set aspect ratio */
.responsive-wrapper-wxh-560x315 {
padding-bottom: 56.25%;
}
.center-block-horiz {
margin-left: auto;
margin-right: auto;
}
.border-5px-inset-4f4f4f {
border: 5px inset #4f4f4f;
}
.set-padding {
padding: 30px;
}
// HTML
<!-- embed responsive iframe -->
<div class="set-padding border-5px-inset-4f4f4f">
<div id="Iframe-YouTube-Life-Coach"
class="border-5px-inset-4f4f4f center-block-horiz">
<div class="responsive-wrapper
responsive-wrapper-wxh-560x315"
style="-webkit-overflow-scrolling: touch; overflow: auto;">
<iframe src="http://www.youtube.com/embed/lhYcUN60QjU?rel=0&showinfo=0">
<p style="font-size: 110%;"><em><strong>IFRAME: </strong>
There is iframe content being displayed
here but your browser version does not support iframes. </em>
Please update your browser to its most recent version
and try again.</p>
</iframe>
</div>
</div>
</div>