In IE, pass the anonymous function on page P1 to another page P2, and then close page P1, then execute the passed anonymous function, and the error “Script has been released and cannot be executed” will be reported. That doesn’t happen with Chrome.

For example, in the figure above, an anonymous function is passed in the iframe to function A of the container page for execution. When the iframe page is replaced and the container page function A is executed, the above error is reported.

I can’t find a good solution, but 1. Try catch when executing anonymous function; The anonymous function is null when caught

2. When the IFrame page is unloaded, cleaning is performed

3. If anonymous functions are bound to events after they are passed, cleaning should include unbinding.