How do I ask for confirmation when closing a window?
5 answers
You need to process the window onbeforeunload
and return a confirmation message as a string.
onunload
won't work here. Demo
+2
source to share
You will need to store all the values of your fields in some variables and check them whenever the page url changes or any link is clicked to catch the page unload event using the page.
Event unloading page / sample http://help.dottoro.com/ljflhicd.php .
0
source to share