简体   繁体   中英

Jquery: windows.onunload not working in Firefox & Chrome

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 IE but it is not working in other browsers.

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

<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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM