From the link below, browser back button detection works perfectly:
http://www.bajb.net/2010/02/browser-back-button-detection/
If you just want to popup a confirmation window before user leaves current page (e.g. click 'Back/Previous' button, close window), use following code (NOT tested in old browsers, e.g. IE6):
<script type="text/javascript">
window.onbeforeunload = onbeforeunload_handler;
function onbeforeunload_handler() {
return "The TEXT in the popup window.";
}
</script>
Unfortunately, the texts on buttons on the popup window cannot be configured as it's different from Browser to Browser.
No comments:
Post a Comment