检测帧位置/内容已更改

发布于 2024-09-06 12:09:26 字数 553 浏览 0 评论 0原文

我有以下情况。我有 2 个框架(顶部和底部)。上部框架监视下部框架中当前加载的页面。我如何知道用户是否更改了该框架的位置(网址)?所以我想知道用户何时按下该页面中的链接,该链接会转到某个地方。

我在这里发现了类似的内容: Detect element contentchanges with jQuery ,但它对我没有帮助(我认为)。

你能给我一些想法吗?

谢谢, Timotei

编辑:底部框架位于另一个域上,因此根据此: Jquery 权限被拒绝 - 不同的域名 是不可能的。

那么,换句话说,是否有任何方法可以使用任何其他浏览器内方法来“监视”用户浏览的页面?

I have the following situation. I have 2 frames (top and bottom). The upper frame monitors the current loaded page in the bottom frame. How can I know if the users changed the location of that frame (the url)? So I want to know when the user, press a link in that page, that goes somewhere.

I found something like this here: Detect element content changes with jQuery , but it doesn't help me (I think).

Could you give me some ideas?

Thanks,
Timotei

EDIT: The bottom frame is on another domain, so according to this: Jquery permission denied - different domain name is not possible.

So, to put it other way, is there any method to "monitor" the pages a users surfs, using any other in-browser method?

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

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

发布评论

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

评论(1

空城仅有旧梦在 2024-09-13 12:09:26

您也许可以存储 iframe 的位置,然后创建一个间隔来查看 SRC 是否已更改。

var theSrc = document.getElementById('myframe').src;

setInterval(function(){
  if (document.getElementById('myframe').src != theSrc) {
    // the URL has changed
  }
}, 5000);

希望它有效:)

You maybe can store the location of the iframe, then create a interval that will look if the SRC has changed.

var theSrc = document.getElementById('myframe').src;

setInterval(function(){
  if (document.getElementById('myframe').src != theSrc) {
    // the URL has changed
  }
}, 5000);

Hope it works :)

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