想要在浏览器或标签关闭时打开弹出窗口 [英] Want to open popup window when browser or tab is closed
问题描述
当我们点击浏览器关闭或窗口选项卡关闭或当我们导航到不同的页面时,有没有人实现打开弹出窗口?
Has anybody implemented to open a popup window when we click Browser close Or window tab close Or when we navigate to different page?
推荐答案
尝试使用:
Try using:
window.onUnLoad= function (evt) {
window.open("yourpage");
}
将在浏览器的onUload事件中调用。
查看以下链接:
http://stackoverflow.com/questions/1025935/capture-event-onclose-browser [ ^ ]
http://stackoverflow.com/questions/1631959/browser-window-close-event [ ^ ]
--Amit
It will be called on onUload event of browser.
Check the links below:
http://stackoverflow.com/questions/1025935/capture-event-onclose-browser[^]
http://stackoverflow.com/questions/1631959/browser-window-close-event[^]
--Amit
你可以使用
Hi,
You can use
window.onbeforeunload = function(e) {
//Open popup here
window.stop();
};
当您从当前页面导航时,它将显示弹出窗口。如果进一步的信息,请做一些谷歌,你会找到你的答案。
谢谢!
It will show the popup when you navigate from the current page. If further info please do some google and you will find your answer.
Thanks!
这篇关于想要在浏览器或标签关闭时打开弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!