How can I make a JavaScript alert before a page closes?

Posted by Nuha on Stack Overflow See other posts from Stack Overflow or by Nuha
Published on 2010-04-14T05:19:58Z Indexed on 2010/04/14 5:32 UTC
Read the original article Hit count: 284

Filed under:
|
|
|
|

I want to write JavaScript code that would, when I close the current HTML page, display an alert message like "Are you sure?"

I want to take the value of the button from the alert message, whatever the user pressed. How can I do this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about close