Possible duplicate:How to prevent browser window from closing?
I want to show the warning message βPlease log out before closing the windowβ with the exit button when the user tries to close the window and after clicking the exit button the window may be closed. How to achieve this?
Another implementation you can try:
<html> <head> <script type="text/javascript"> window.onbeforeunload = function() { return "Did you save your stuff?" } </script> </head> <body> </body> </html>
window.onbeforeunload = function() { return "Are you sure?"; };
Try it.
There is no such closed event in Javascript. You can pass onUnload message. But this does not prevent the application from closing. This function will be executed when the user clicks any link, submits a form, etc.
window.onunload=function(){SomeJavaScriptCode};
For reference: http://www.w3schools.com/jsref/event_onunload.asp
Source: https://habr.com/ru/post/1444047/More articles:Magento 1.7: Remove the pagination at the top and keep the pagination at the bottom - paginationWriting HTML inside echos VS Writing HTML between PHP tags - htmlhow to make audio streaming in Android without using any native api - androidXMPPFramework - How can I update my own avatar image? - iosSpeechRecognizer: not connected to the recognition service - androidHow to parse HTML tags in matlab using regexp? - htmlWhy doesn't \ n work in the Log.Info method? - c #Access to dgemm in C ++ - c ++Scrapy crawls the first page but doesn't follow links - pythonCentral Button LWUIT softkey - javaAll Articles