Hi All,
I have a javascript class with methods and properties.
Is it possible to wire this class up to a pageunload event?
I am trying to call a method in my class when the user moves pages.
How can I do this.
Thanks
Hi All,
I have a javascript class with methods and properties.
Is it possible to wire this class up to a pageunload event?
I am trying to call a method in my class when the user moves pages.
How can I do this.
Thanks
Returning a string from the onbeforeunload
event handler will show a dialog box.
<html>
<head>
</head>
<body>
test
<script>
window.onbeforeunload = function () {
return "*** Warning: changes are not saved! ***";
};
</script>
</body>
</html>
In internet explorer this dialog looks like this:
---------------------------
Windows Internet Explorer
---------------------------
Are you sure you want to navigate away from this page?
*** Warning: changes are not saved! ***
Press OK to continue, or Cancel to stay on the current page.
---------------------------
OK Cancel
---------------------------
Your text will be sandwiched between some browser specific text, but that is the only way.