Causes and solutions for "unable to execute a freed script code" error _javascript Tips

Source: Internet
Author: User
Many Web developers may have encountered this problem, the program inexplicably appears "unable to execute code that has been freed script," error row 1, column 1. For this message description is not the same, row and column description is a disorderly write JS error, I believe that all debugging JS program friends are the most depressed also the most hated things! Encounter this problem, the simplest way to directly put the wrong to Baidu or Google that small input box to let them first to point guidance, and then to solve, but this time it is not so easy, in Baidu search seems a lot of people have encountered this problem, but are what QQ space error, Crazy Halo, Or just ask no answer, stuffy!

Where does this mistake start? There is no way, but also guess is try...catch jump error, looking for a long time finally found the wrong location, but found that there is no problem to write, and then racked their brains to think about the process of interpretation, there is still no clue. Continue to Baidu, suddenly in a Web page to see a sentence: When a page closes will automatically release the page JS. A short speech gave me no small inspiration. Check to see if my program has a page turned off or turned on, and found that it was performing a turn, and then came back to this page with an error. All of a sudden I think I understand.

Scene: Page has A and B two frames page iframe, in the B page through JS to a function reference to a page saved in a page of a variable, a page can use this reference to execute the B page of some programs, when the B page refresh because of a page to B page reference has been lost, However, a reference passed before the B page is still saved in a, but the current reference cannot be referenced to page B so that "unable to execute the script code that has been released" appears at execution time

Workaround: Add fault-tolerant processing to page A and empty references when errors occur or point to a default function. In addition, when the B page is loaded again to transfer function references to page A, this error will not occur.

Perhaps the description here is too abstract, look at a demo and look at the code is easy to understand, first Test, then return URL, and then test will appear this problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.