3

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

Dr. Rajesh Rolen
  • 14,029
  • 41
  • 106
  • 178
Pradeep Singh
  • 3,582
  • 3
  • 29
  • 42

1 Answers1

3
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

Mohammed Abrar Ahmed
  • 2,290
  • 3
  • 15
  • 33
Dr. Rajesh Rolen
  • 14,029
  • 41
  • 106
  • 178