检测 iframe 中的活动窗口
我想知道为什么这个网址 http://www.thefutureoftheweb.com/demo/2007-05-16-detect-browser-window-focus/
当单独打开时,效果很好。
在 iframe 中加载时不会模糊 http://speedywap.com/ihome/?url=
奇怪的是,当您单击 iframe 并单击返回主页时,它会变得模糊,但其他情况下却不会。
看看下面的截图
我不明白的是,为什么 iframe 没有从初始加载中模糊,因为只有一个窗口可以处于活动状态。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iframe 内页面上的
blur
事件不会发生,因为 iframe 中的文档一开始就没有focus
。当您最初加载页面时,iframe 及其内容会被加载,但不会获得
焦点
。因此,页面加载时不会发生模糊事件。The
blur
event on the page inside the iframe doesn't occur because the document in the iframe never hadfocus
in the first place.When you initially load the page, the iframe and its content are loaded but are not given
focus
. Therefore noblur
event can happen on page load.