iFrame 的 webkitfullscreenchange 事件

发布于 2024-12-19 01:38:26 字数 414 浏览 4 评论 0原文

/* works on all elements except iframes */
document.addEventListener("webkitfullscreenchange", function() {
   alert("hello world");
}, false); 

/* never triggers even when iFrame enters full screen */
myIframe.addEventListener("webkitfullscreenchange", function() {
   alert("hello iframe");
}, false);

我无法获取事件侦听器 webkitfullscreenchange 事件来触发 iframe。 iFrame 是同源的。有谁知道如何获得这项工作?谢谢。

/* works on all elements except iframes */
document.addEventListener("webkitfullscreenchange", function() {
   alert("hello world");
}, false); 

/* never triggers even when iFrame enters full screen */
myIframe.addEventListener("webkitfullscreenchange", function() {
   alert("hello iframe");
}, false);

I am not able to get event listener webkitfullscreenchange event to trigger for iframes. iFrame is under the same origin. Does anyone know how to get this work? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

顾铮苏瑾 2024-12-26 01:38:26

如果有人问同样的问题,则必须在 iframe 上设置 allowfullscreen=true

(https://wiki.mozilla.org/Gecko:FullScreenAPI#fullscreenchange_event

If someone ask for the same issue, allowfullscreen=true on iframe must be setted

(https://wiki.mozilla.org/Gecko:FullScreenAPI#fullscreenchange_event)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文