How to create popup window when browser close

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

Answers:

Answer
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

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.