检测 iframe 中的活动窗口

发布于 2024-11-27 06:13:22 字数 673 浏览 3 评论 0 原文

我想知道为什么这个网址 http://www.thefutureoftheweb.com/demo/2007-05-16-detect-browser-window-focus/ 当单独打开时,效果很好。

在 iframe 中加载时不会模糊 http://speedywap.com/ihome/?url=

测试 URL

奇怪的是,当您单击 iframe 并单击返回主页时,它会变得模糊,但其他情况下却不会。

看看下面的截图 首次加载 iframe 时

我不明白的是,为什么 iframe 没有从初始加载中模糊,因为只有一个窗口可以处于活动状态。

I want to know why this url http://www.thefutureoftheweb.com/demo/2007-05-16-detect-browser-window-focus/
When opened separately this does work well.

is not being blurred when it is being loaded in the iframe http://speedywap.com/ihome/?url=

Test URL

The strange this is that when you click on the iframe and click back on the main page it is blurred but else it isn't.

Look at the screenshots below
When the iframe is loaded the first time

Clicking the iframe and then the bar

What I don't get is why isn't the iframe blurred from the initial load as only one window can be active.

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

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

发布评论

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

评论(1

单身情人 2024-12-04 06:13:22

iframe 内页面上的 blur 事件不会发生,因为 iframe 中的文档一开始就没有 focus

当您最初加载页面时,iframe 及其内容会被加载,但不会获得焦点。因此,页面加载时不会发生模糊事件。

The blur event on the page inside the iframe doesn't occur because the document in the iframe never had focus in the first place.

When you initially load the page, the iframe and its content are loaded but are not given focus. Therefore no blur event can happen on page load.

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