如何检测框架 url 何时更改?

发布于 2024-09-15 21:03:16 字数 266 浏览 5 评论 0原文

我有以下内容:

<frame src="myframe.htm" id="myframe"/>
<frame src="http://www.google.com" id="external" />

单击框架上的链接时如何检测框架 "external" 中的任何新网址,以便我可以将其显示在框架 "myframe" 上? 我想使用 javascript

谢谢

I have the following:

<frame src="myframe.htm" id="myframe"/>
<frame src="http://www.google.com" id="external" />

How to detect any new url in the frame "external" when clicking a link on it so i can display it on the frame "myframe" ?
I want to use javascript for that

Thanks

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

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

发布评论

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

评论(1

厌倦 2024-09-22 21:03:16

如何检测框架中的任何新网址

如果 iframe 的文档与父页面不在同一域中,简短的答案是:您不能,因为 单源策略

但是,如果您控制包含链接的页面,您可能可以为链接提供类似 的目标应该打开其他 iframe 中的链接。

How to detect any new url in the frame

If the iframe's document is not on the same domain as the parent page, the short answer is: You can't due to the Single Origin Policy.

However, if you control the page containing the links, you might be able to give links a target like <a target="external" href=..... which should open the links in the other iframe.

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