I am using OAF framework which automatically binds a function to onbeforeunload event(like onbeforeunload="_savePageStateIE()"
).
I am using the below code unbind standard func and bind a custom func. But it is working in all browsers except IE.
<html>
<script>
window.onbeforeunload=null;
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "You have attempted to leave this page.";
}
</script>
<body onbeforeunload="_savePageStateIE()">
<h1 style="color:red">Hello World</h1>
</body>
</html>
`
– Abhitalks May 30 '14 at 08:36