admin管理员组文章数量:1303404
For the following iframe code:
<iframe src="testA.html" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
Inside testA.html, how do I tell if the webkitAllowFullScreen attribute is included using javascript?
For the following iframe code:
<iframe src="testA.html" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
Inside testA.html, how do I tell if the webkitAllowFullScreen attribute is included using javascript?
Share Improve this question edited Dec 13, 2011 at 1:10 Yahel 37.3k23 gold badges106 silver badges154 bronze badges asked Dec 12, 2011 at 23:26 wwwuserwwwuser 6,37210 gold badges57 silver badges65 bronze badges2 Answers
Reset to default 5If the allowfullscreen attributes are added to the iframe the variable below should be true
var fullscreenEnabled = document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled;
This even works when the iframe src is on a different domain.
Note: the letter s in fullscreenEnabled is uppercase for Firefox
This is the most robust solution:
if(window.frameElement && window.frameElement.hasAttribute("webkitAllowFullScreen")){
}
It utilizes window.frameElement
, which returns the DOM node of the parent framing element, which you can then make a hasAttribute
call against.
本文标签: jqueryHow to read webkitAllowFullScreen attribute in iframe using javascriptStack Overflow
版权声明:本文标题:jquery - How to read webkitAllowFullScreen attribute in iframe using javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741750619a2395805.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论