Capture the browser close event from the close button on top left corner
-
HI, Please let me know hot can I capture the Browser close when the user close the browser from the close button on the top left side on the browser. Thanks a lot
-
HI, Please let me know hot can I capture the Browser close when the user close the browser from the close button on the top left side on the browser. Thanks a lot
There is a difference in capturing and preventing the browser from closing. Since you only want to capture, you can consider quite a few of events; such as
beforeunload
, and handle them to just prompt them that you are going to close the browser.window.onbeforeunload = function(e) {
var dialogText = 'Dialog text here';
e.returnValue = dialogText;
return dialogText;
};Although it may work in preventing the browser from closing as well, if you simply return null from within the function. Have a look here, [javascript - How to capture the browser window close event? - Stack Overflow](http://stackoverflow.com/questions/1631959/how-to-capture-the-browser-window-close-event) Also, in future, please also consider going through MDN documentation to see what of the APIs are available and how you can use them; [WindowEventHandlers.onbeforeunload - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload)—read the note provided there, it mentions that the calls to confirm or alert may be ignored in this event.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
HI, Please let me know hot can I capture the Browser close when the user close the browser from the close button on the top left side on the browser. Thanks a lot
No event is raised that you can hook into via js.
-
No event is raised that you can hook into via js.
-
onbeforeunload works. I use it.
There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.
That doesn't just fire for closing the browser though, you don't know if it is firing due to page navigation or the browser closing.
-
That doesn't just fire for closing the browser though, you don't know if it is firing due to page navigation or the browser closing.
True. Good clarification. I'm going to guess, and could be wrong, that the user wants to know when their app or page is closed.
There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.
-
HI, Please let me know hot can I capture the Browser close when the user close the browser from the close button on the top left side on the browser. Thanks a lot
is their any solution or any easy way by which we can make <a href="http://www.facebook.com">html</a> coding [URL=http://www.google.com]google[/URL] is their any solution or any easy way by which we can make <pre><a href="http://www.facebook.com">html</a></pre> coding <pre>[URL=http://www.google.com]google[/URL]</pre> is their any solution or any easy way by which we can make
<a href="http://www.facebook.com">html</a>
coding
[URL=http://www.google.com]google[/URL]
google Is Development The Greatest Imperative Aspect of Growth?
-
There is a difference in capturing and preventing the browser from closing. Since you only want to capture, you can consider quite a few of events; such as
beforeunload
, and handle them to just prompt them that you are going to close the browser.window.onbeforeunload = function(e) {
var dialogText = 'Dialog text here';
e.returnValue = dialogText;
return dialogText;
};Although it may work in preventing the browser from closing as well, if you simply return null from within the function. Have a look here, [javascript - How to capture the browser window close event? - Stack Overflow](http://stackoverflow.com/questions/1631959/how-to-capture-the-browser-window-close-event) Also, in future, please also consider going through MDN documentation to see what of the APIs are available and how you can use them; [WindowEventHandlers.onbeforeunload - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload)—read the note provided there, it mentions that the calls to confirm or alert may be ignored in this event.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
We travel nationwide to deliver the best Google Analytics, Google Ad Words, and Google Tag Manager Training to digital marketers everywhere. html