Reputation: 35832
Ask a question, and while editing the body of your question, click on some link on the page. StackOverflow's script knows that you are not finished yet, and warns you about loosing your unsaved data. However, it's confirmation box is not a jQuery plugin, or anything like that. It seems that its confirmation box is browser-specific box, something like JavaScript's confirm
box. To prove it, simply check it in many browsers and you see different UI styles.
How they've done it? Which JavaScript command?
Upvotes: 0
Views: 256
Reputation: 5326
Trying setting a global flag to know when the page is "editing" and then use the onbeforeunload event
window.onbeforeunload = function(){ return globalEditingFlag ? 'You are editing': null }
Upvotes: 1
Reputation: 2654
Look at this : http://www.w3schools.com/js/js_popup.asp
The section about the confirm box
Upvotes: 0