Click here to Skip to main content
15,498,859 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
How to confirm from user before closing the browser window i.e Are you sure you want to close the current window using Javascript? Option to Close browser window : Ctrl + W, ALT + F4, Clicking on X Mark on window.
Posted
Updated 15-Apr-21 2:05am
v3
Comments
Sandeep Mewara 14-Jul-10 1:47am    
You don't need to post full question in the title. It should be short and simple.

1 solution

Here is your answer

XML
window.onbeforeunload = function(){
  return "Are you sure?";
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900