Unable to execute code from freed script - IE6 IE7 IE8 IE9

I ran into this problem today in IE6 (but it plays in all recent versions of IE).

I noticed that a lot of people got into this problem, and I did not see a very practical way to fix it.

There seems to be some other solution regarding the order of the script tags and the meta tags in the header of the HTML document. I do not confirm this, but here is the link anyway: What causes the error "Unable to execute code from a freed script"

I also know the solution to this problem, so I post it below

+8
javascript internet-explorer-8 internet-explorer-9 internet-explorer-7 internet-explorer-6
source share
3 answers

First of all, you need to find the source of the message.

IE is known for providing terrible bug reporting, but fortunately, IE9 seems somewhat capable. If this error occurs in IE6, IE7 or IE8, it will also happen in IE9, so use IE9 for debugging (for your convenience)

Open the webdeveloper console in IE9 (press F12) and follow the steps to get this error.

IE9 should now provide you with information about the file and line in the console, yay!

What usually goes wrong is a callback that is executed after some delay, either with setTimeout or because of an Ajax request. If the window, document or callback frame is defined as unloaded, you will receive this message when it tries to execute your callback function.

Other browsers seem to be ignoring this issue, and I think this is normal. To make IE, do the same, just wrap the callback in a try-catch block (I don't know what the callback will answer for, I don't think it evaluates to undefined). If you want to have more accurate error handling, or if you really want to take action when this happens, you can probably do it, and please post here because I'm curious about which use case will actually require it.

+16
source share

If you have a page that uses multiple frames, this error may be caused by the fact that objects initialized in one frame are used in another frame after the original frame has been deleted from the page.

If this happens, then depending on the situation, you can:

  • Check out your code that looks for potential memory leaks.
  • If this object represents some data that you really want to transfer between frames, then consider using their string form.
0
source share

Solution - Be sure to place all META statements in front of any script statements.

-2
source share

All Articles