简体   繁体   English

实际上是否可以在浏览器CLOSE上打开弹出窗口?

[英]Is there actually a way to open a popup on browser CLOSE?

I'm trying to launch a "logout" page if the usesr closes the browser...I've looked for a couple of days and I think I have looked at all of the related topics...tried quite a few...but so far, nothing is working the way I need it to... 如果用户关闭浏览器,我正在尝试启动“注销”页面。我已经看了几天,而且我想我已经看了所有相关主题...尝试了很多。 。但到目前为止,没有任何事情能按我需要的方式工作...

Everything seems to trigger just navigating to the next page...I want to be able to navigate the site and NOTHING IF I LOG OUT...but if I CLOSE THE BROWSER (or the DOMAIN changes), I want to fire the logout page. 一切似乎都触发了,只是导航到下一页...我希望能够浏览该网站,并且如果我注销就什么也没有...但是,如果我关闭浏览器(或域更改),我想触发注销页。

Actually, it really doesn't need to open a popup...but that would be my preference... 实际上,实际上并不需要打开弹出窗口...但这是我的偏爱...

Thanks for any help in getting a definitive answer... 感谢您对确定性答案的任何帮助...

HOLD THE PHONE... 挂电话...

Just FYI...I found what seems to be working here: [http://eureka.ykyuen.info/2011/02/22/jquery-javascript-capture-the-browser-or-tab-closed-event/][1] 仅供参考...我发现似乎在这里起作用:[http://eureka.ykyuen.info/2011/02/22/jquery-javascript-capture-the-browser-or-tab-closed-event/ [1]

...and it also seems that there are some very useful variations from contributers. ...而且似乎贡献者也有一些非常有用的变化。

I also added a line to the original script to execute my logout page... 我还向原始脚本添加了一行以执行我的注销页面...

您应该能够使用onbeforeunload添加侦听器,并在提示https://developer.mozilla.org/en-US/docs/DOM/window.onbeforeunload中询问用户是否要注销。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM