Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / June 2005



Tip: Looking for answers? Try searching our database.

prevent "can't execute code from freed script"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
reformy - 30 Jun 2005 13:28 GMT
hi
i have a page with a form, and when the page is loaded, it supposed to
execute some javascript code.
when i go to that page, i get "can't execute code from freed script"
error, and the js code isn't executed. If i hit F5 and refresh the
page, it works fine.
any know what's the problem?

i looked abit in the net and saw some1 blaming a pop-up killer utility,
but i don't have any (i think). does that sound relevant?

thanks
yair
Christopher J. Hahn - 30 Jun 2005 13:43 GMT
> hi
> i have a page with a form, and when the page is loaded, it supposed to
[quoted text clipped - 9 lines]
> thanks
> yair

Yair,
I had this problem quite a bit when I was objectifying all of my site's
code. It came up for me basically when I was trying to use code
(especially an object) that wasn't part of the page I was viewing. For
instance, if some code in one frame creates an object, then other
frames may only use that object so long as the page that made it is
still loaded (and hasn't been reloaded) in the first frame.

I'm not sure what the technical terms for all of these concepts are,
but this is how I understand it:
Generally speaking, scripts are parts of documents. When you navigate
away from a document, its scripts are unloaded, or "freed", meaning
that they're cleaned out of memory and thrown away. This includes any
data (such as objects and nodes and such) that the scripts may have
generated.

So for instance, if your document references an object in a child
iframe, and if the iframe then navigates away from its current URI or
reloads itself, then the object is "freed" and no longer exists for any
practical purposes. Trying to operate on the object in any way would
then result in the error: "Can't execute code from a freed script."

I don't know how much this applies to what you're experiencing, but the
way I got around it was to basically clone the data I needed so that
the frame that needed it had a local copy.

Someone else here can probably give you a more technical (and more
accurate) explanation, but I hope this helps in some way.
LV_Indy - 30 Jun 2005 15:31 GMT
Hahn's description was exactly right.  Sounds like you must be using
frames as well and the script you are trying to access isn't available
anymore because something got loaded in its place.  Safest way is to
load all code that needs to stick around either in the frame that
accesses it or in a frame that never changes src.  If you can figure
out which peice of code is missing then I would put it into a frame
that never changes src because if you have more than 2 frames, it could
be 2 of the non-visible frames trying to communicate between each other
and then putting it in the visible frame might not do the trick.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.