获取以下iframe代码:
<iframe src="testA.html" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>在testA.html中,如何使用javascript判断是否包含webkitAllowFullScreen属性?
发布于 2011-12-13 07:35:46
这是最健壮的解决方案:
if(window.frameElement && window.frameElement.hasAttribute("webkitAllowFullScreen")){
}它利用window.frameElement返回父框架元素的DOM节点,然后可以对其进行hasAttribute调用。
发布于 2012-11-19 17:53:06
如果将allowfullscreen属性添加到iframe,则下面的变量应为true
var fullscreenEnabled = document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled;甚至当iframe src在不同的域上时也是如此。
火狐注意:对于,fullscreenEnabled中的字母s是大写的
https://stackoverflow.com/questions/8482399
复制相似问题