本文介绍了浏览器关闭时如何创建弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在浏览器关闭或关闭标签页时打开弹出窗口.
I want to open popup window when browser closed or closed tabs.
推荐答案
window.onUnLoad= function (evt) {
//your code goes here
window.open("yourpage/some link");
}
编辑注意:现在它将在浏览器的 onUnload 事件上调用.立即尝试
EDIT NOTE: Now it will be called on onUnload event of browser. Try now
尝试 window.onclose 事件:
Try window.onclose event:
https://developer.mozilla.org/en/DOM/window.onclose
参考资料:
http://dotnetacademy.blogspot.com/2010/09/call-function-in-javascript-before.html
在下面,您可以找到所有带有 javascript 窗口示例的事件:
On below like you can find all events with example of window for javascript:
http://www.java2s.com/Tutorial/JavaScript/0380__Window/windowonUnLoad.htm
这篇关于浏览器关闭时如何创建弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!