iframe 父级的 document.referrer
我有一个页面 - page1.html,其中包含带有 url(src) iframepage.html 的 iframe。当我单击 iframepage 中的链接时,我会转到其他网站 - page2.html。如果我在 page2.html 上调用 document.referrer,我就会得到 iframepage url。根据 document.reffer 定义,这是正确的 - 这是打开当前文档的文档,但是:
有没有办法将 page1.html 作为 page2.html 上的 document.referrer 获取?
从 page2.html 我必须知道 page2.html 从哪个浏览器 url 打开。
谢谢
I have a page - page1.html, which contains iframe with url(src) iframepage.html. When I click on the link from iframepage, I go to some other website - page2.html. If i call document.referrer on the page2.html, I have the iframepage url. This is correct according to document.reffer definition - which is the document, that opened current document, but:
Is there any way to get as document.referrer on page2.html the page1.html?
From page2.html I have to know from which browser url was page2.html opened.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

在 page2.html 中,您可以检查 javascript 中的
window.parent.location.href
以返回包含的父级 URL。
In page2.html you can check
window.parent.location.href
in javascript to return the URL of the parent containing the<iframe>
.