Try this:
<script>
window.onbeforeunload = function (e) {
e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue="Sure?";
}
// For Safari
return 'Sure?';
};
</script>
Here is a working jsFiddle
More Related Contents:
- How to get 100% ADA compliance result in accessibility checker website https://webaccessibility.com? [closed]
- jQuery doesn’t give a proper output, but gives these [closed]
- contenteditable change events
- Avoid dropdown menu close on click inside
- How to properly use jsPDF library
- How to get the element clicked (for the whole document)?
- How to clear the contents of an iFrame from another iFrame
- Prevent form redirect OR refresh on submit?
- HTML5 check if audio is playing?
- Can I get image from canvas element and use it in img src tag?
- Is it possible to access Shadow DOM elements through the parent document?
- How to get all checked checkboxes
- Reset select value to default
- How to get all the applied styles of an element by just giving its id?
- How to develop Desktop Apps using HTML/CSS/JavaScript? [closed]
- Counting and limiting words in a textarea
- Writing file to desktop using HTML5 FileSystem API
- css position absolute making the textbox go down
- Proper way to reset a GIF animation with display:none on Chrome
- How can I prevent refresh of page when button inside form is clicked?
- Javascript Marquee to replace tags
- Passing JSON data from php to html-data attribute and then to Javascript
- iframe Auto Adjust Height as content changes
- Detect if dropdown navigation would go off screen and reposition it
- Iframe inherit from parent
- Reading multiple files with Javascript FileReader API one at a time
- Converting sanitised html back to displayable html
- Creating a Clickable Grid in a Web Browser
- Checking if a textbox is empty in Javascript
- Rename Object Key in an array using javascript