prevent "can't execute code from freed script"

Discussion in 'Javascript' started by reformy, Jun 30, 2005.

  1. reformy

    reformy Guest

    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
     
    reformy, Jun 30, 2005
    #1
    1. Advertising

  2. reformy wrote:
    > 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.
     
    Christopher J. Hahn, Jun 30, 2005
    #2
    1. Advertising

  3. reformy

    LV_Indy Guest

    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.
     
    LV_Indy, Jun 30, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ThunderMusic

    Prevent service from stopping

    ThunderMusic, Jan 11, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    4,798
  2. Replies:
    5
    Views:
    982
    Dave Pollum
    Mar 17, 2006
  3. Stan
    Replies:
    1
    Views:
    1,852
    Tomasz Kaszuba
    Jun 30, 2003
  4. Marcelo

    Prevent Postback with ImageButton

    Marcelo, Jul 1, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    947
    Kairi Zikpin
    Jul 1, 2003
  5. Martin Waller

    Can't execute code from freed script

    Martin Waller, Dec 3, 2004, in forum: ASP General
    Replies:
    1
    Views:
    258
    Martin Waller
    Dec 3, 2004
Loading...

Share This Page