Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
194
rated 0 times [  200] [ 6]  / answers: 1 / hits: 26849  / 14 Years ago, mon, november 1, 2010, 12:00:00

I want to open popup window when browser closed or closed tabs.


More From » popup

 Answers
106
window.onUnLoad= function (evt) { 
//your code goes here
window.open(yourpage/some link);
}


EDIT NOTE: Now it will be called on onUnload event of browser. Try now



Try window.onclose event:



Capture event onclose browser



https://developer.mozilla.org/en/DOM/window.onclose



How to capture the browser window close event?



References:



http://dotnetacademy.blogspot.com/2010/09/call-function-in-javascript-before.html



On below like you can find all events with example of window for javascript:



http://www.java2s.com/Tutorial/JavaScript/0380__Window/windowonUnLoad.htm


[#95121] Thursday, October 28, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
valentinam

Total Points: 166
Total Questions: 117
Total Answers: 81

Location: Puerto Rico
Member since Sun, Jun 27, 2021
3 Years ago
;