是什么导致错误“无法从释放的脚本中执行代码"? [英] What causes the error "Can't execute code from a freed script"

查看:18
本文介绍了是什么导致错误“无法从释放的脚本中执行代码"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为我不久前找到了解决方案(请参阅我的 博客):

I thought I'd found the solution a while ago (see my blog):

如果您遇到 JavaScript(或者应该是 JScript)错误无法从释放的脚本中执行代码" - 尝试移动头部中的任何元标记,使它们位于您的脚本标记之前.

If you ever get the JavaScript (or should that be JScript) error "Can't execute code from a freed script" - try moving any meta tags in the head so that they're before your script tags.

...但根据最近的一篇博客评论,我建议的修复方法可能并不适用于所有人.我认为这是向 StackOverflow 社区开放的好方法....

...but based on one of the most recent blog comments, the fix I suggested may not work for everyone. I thought this would be a good one to open up to the StackOverflow community....

导致无法从释放的脚本执行代码"错误的原因是什么?有哪些解决方案/变通方法?

What causes the error "Can't execute code from a freed script" and what are the solutions/workarounds?

推荐答案

当您调用在不再存在的窗口或框架中创建的函数时,您会收到此错误.

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

如果你事先不知道窗口是否还存在,你可以做一个 try/catch 来检测它:

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

这篇关于是什么导致错误“无法从释放的脚本中执行代码"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆