Question

In Jquery i invoke the method $(window).unload(). it is used for when i closing the browser window i'm return the some values.this function is working fine in I.E. but it is not working in other browsers.

$(window).unload() function is for i.e ? Anybody can help me. thanks in advance.

Was it helpful?

Solution

<script>
window.onbeforeunload = function() {
    return "Are you sure?";
 };
</script>

or

$(window).on('beforeunload', function() {
    return 'Your own message goes here...';
});

in chorme there are several blocked method on onbeforeunload like alert..
A chorme example of the debugging console for an alert:

Blocked alert('My Window is reloading') during beforeunload.

ref1 ref2

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top