IE9 firing onbeforeunload event when the window opens
问题 I'm building a site using the JFileUpload applet and want to handle the closing of a page in a certain way. JSTransferCancelled is called when the applet is cancelled. The following code is what I'm using to handle these events and it works in all browsers except IE. function JSTransferCancelled(){ bCancel=false; $.post("cancel.php"); self.close(); } $(window).load(function(){ $(window).bind('beforeunload',function(){ document.uploader.setEnabled(false); if(bCancel){ document.uploader.cancel(