OnBeforeUnload 警告(刷新当前页面时除外)
有谁知道是否可以检查 OnBeforeUnload 事件触发时用户离开的页面。我想在用户实际离开当前页面时通知他们,而不是在他们刚刚重新加载页面时通知他们。
Does anybody know if it is possible to check what page a user is leaving for when the OnBeforeUnload event fires. I want to notify users when they are actually leaving the current page but not when they are just reloading it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,如果浏览器告诉网页用户要去哪里,那将是一个巨大的安全漏洞。我想如果网页只准确地告诉你想知道什么,这不会有问题——这是/不是重新加载——但是不,我不明白你是如何弄清楚这一点的。
Nooo, that would be a huge security hole if the browser told the webpage where the user was going. I suppose it wouldn't be a problem if the webpage were told only exactly what it is you want to know -- this is/is not a reload -- but nope, I can't see how you could figure that out.