Internet Explorer calling [removed] on window.open and AJAX calls

后端 未结 8 1549
刺人心
刺人心 2021-01-04 11:21

Ok, I have spent a while on this problem and this is what I have gathered:

  1. If you make an AJAX call in IE7 and you have a window.onbeforeunload function spe

8条回答
  •  遥遥无期
    2021-01-04 11:58

    This could very possible solve your problem!

    Because I had a similar issue and this made go way!

    window.onbeforeunload = warnFunction;
    var warnRequired = true;
    function warnFunction () {
        if (warnRequired) return ("Please Stay! Don't go!");
        return ;
    }
    

    And whenever I do a Ajax call or Popup another window, I just set warnRequired to false.

    One other thing just be aware when making an Ajax call that it is synchronized else the variable might not have been set yet! (A nasty Gotcha!)

提交回复
热议问题