What causes the error “Can’t execute code from a freed script”

You get this error when you call a function that was created in a window or frame that no longer exists.

If you don’t know in advance if the window still exists, you can do a try/catch to detect it:

try
{
  f();
}
catch(e)
{
  if (e.number == -2146823277)
    // f is no longer available
    ...
}

Leave a Comment