Here in stackoverflow, if you started to make changes then you attempt to navigate away from the page, a javascript confirm button shows up and asks: \"Are you sure you want
To make this work in Chrome and Safari, you would have to do it like this
window.onbeforeunload = function(e) { return "Sure you want to leave?"; };
Reference: https://developer.mozilla.org/en/DOM/window.onbeforeunload