Can't execute code from a freed script

前端 未结 4 677
挽巷
挽巷 2021-01-21 05:51

I have a function that in a different frame that I need to override. In addition, I need to call the original function from within my override. To do so, I\'m using the followin

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-21 06:26

    If you're comming here from google and are looking for an easy solution to fix this problem in IE:

    In our case the problem occured, because we were working with events inbetween iframes. By doing so it was possible that, upon changing the iframe contents combined with a triggered event it would attempt to call the script on the now changed iframe document. this raised the exception in question.

    by adding

    $(window).on("unload", function(){
        $(target).off(eventname, handler);
    });
    

    the problem would cease to be raised. Finally no try/catch because of IE.

提交回复
热议问题