获取 window.onunload 事件中接下来打开的页面的 url

发布于 2024-09-08 08:12:52 字数 62 浏览 0 评论 0原文

有没有办法获取 window.onunload 事件中接下来打开的页面的位置。

此致, 克沙夫

Is there a way get the location for page being opened next in the window.onunload event.

Best Regards,
Keshav

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

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

发布评论

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

评论(2

以往的大感动 2024-09-15 08:12:52

不!这将是一个安全问题。想象一下有人从色情网站导航到银行网站。反过来(使用 HTTP Referrer 标头)已经有些令人头疼了。 Firefox 允许抑制引荐来源网址:

在地址栏中输入 about:config
搜索推荐人(原文如此)
将 network.http.sendRefererHeader 设置为 0

(由 http://cafe.elharo.com/privacy/privacy-tip-3-block-referer-headers-in-firefox/

No! That would be a security problem. Imagine someone navigating from a porn site to a banking site. The other way round (with the HTTP Referrer header) is already somewhat a headache. Firefox allows to suppress the referrer:

Enter about:config in the address bar
Search for referer (sic)
Set network.http.sendRefererHeader to 0

(Courtesy to http://cafe.elharo.com/privacy/privacy-tip-3-block-referer-headers-in-firefox/)

扛刀软妹 2024-09-15 08:12:52

当前页面不能也不应该知道用户下一步想要去哪里(通过地址栏或书签)(正如@nalply所说)。

如果您的情况是您想知道用户在您的页面上单击了哪个链接,那么您可以使用 javascript 来完成此操作。有一个临时变量,每次用户单击页面上的链接时,该变量都会填充 URL。然后在window.onunload中,就可以使用这个了。

如果这不是您的情况,您能说出您的具体要求以及为什么要这样做吗?如果您说出您想要实现的目标,也许您可​​能会得到更好的解决方案。

The current page cannot and should not know where the user wants to go next (via address bar or bookmarks) (as @nalply said).

If your situation is you want to know which link that the use clicked on your page, then you can do this with javascript. Have a temporary variable that is populated with the URL everytime the user clicks on a link on your page. Then in window.onunload, you can use this.

If this is not your situation, can you tell your specific requirement on why you want to this? Perhaps you might get better solutions if you tell what you are trying to acheive.

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