prevent "can't execute code from freed script"

R

reformy

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
 
C

Christopher J. Hahn

reformy said:
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

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.
 
L

LV_Indy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top