Ok, I have spent a while on this problem and this is what I have gathered:
If you make an AJAX call in IE7 and you have a window.onbeforeunload function specified, it calls the onbeforeunload function.
If you try to open a new window with window.open WITHOUT disturbing the current window, the onbeforeunload gets called.
Does anyone know how to stop this? I even tried setting a variable to TRUE and check that variable in my onbeforeunload function and it still dosent work! I just need to be able to stop the execution of that method for AJAX calls and new window calls.
Another and probably simpler option is to return false when you open the popup:
<a onclick="window.open(...); return false;" href="javascript:;" >my link</a>
This seems to stop IE from thinking you're leaving the page and triggering the event. All the other options weren't particularly viable for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With