假设我将其作为嵌入代码(随机youtube视频...):
<iframe
width="560"
height="315"
src="http://www.youtube-nocookie.com/embed/U5X4N2exOsU"
frameborder="0"
allowfullscreen>
</iframe>
youtube如何知道允许全屏(获取参数)?
我认为它与javascript的混乱有关,它被压缩并包含在iframe(http://s.ytimg.com/yt/jsbin/www-embed_core_module-vflyEJLff.js)中
答案 0 :(得分:1)
IFRAME
上的Expando属性可通过window.frameElement
属性访问。这是一个例子:
<强> Test1.htm:强>
<html><body>
<iframe
width="560"
height="315"
src="Test2.htm"
frameborder="0"
allowfullscreen=123>
</iframe>
</body></html>
<强> Test2.htm:强>
<html><body>
<script>
document.write(window.allowfullscreen);
</script>
</body></html>
如果expando没有值(例如在您的示例中),则它只是""
。