3

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

Dr. Rajesh Rolen
  • 13,643
  • 39
  • 101
  • 175
Pradeep Singh
  • 3,526
  • 3
  • 28
  • 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,070
  • 2
  • 13
  • 30
Dr. Rajesh Rolen
  • 13,643
  • 39
  • 101
  • 175