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.