Javascript 使用 IE9 的网站上的“SCRIPT28:堆栈空间不足”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6280469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"SCRIPT28: Out of stack space" on website using IE9
提问by MissioDei
I am having an issue where all link button controls on my page do not work once we deploy our website to our production server. Here are a few details:
我遇到了一个问题,一旦我们将我们的网站部署到我们的生产服务器,我页面上的所有链接按钮控件都不起作用。以下是一些细节:
We have 3 environments upon which we develop: Our local Machine, which uses local IIS7 to run for development; test environment which is an actual webserver behind our firewall(IIS6); Production which is our live webserver(IIS6). The website works fine on local machines and test server but once we click a link button on production server it hangs.
The problem does not exist in Chrome, or FireFox it only exists in IE9. It does not exist when you put IE9 in compatibility mode.
If I use the IE9 Developer tool bar and watch the scripts, as soon as you click one of the link buttons the console shows this error:
我们有 3 个开发环境:我们的本地机器,使用本地 IIS7 运行进行开发;测试环境,它是我们防火墙后面的实际网络服务器(IIS6);生产这是我们的实时网络服务器(IIS6)。该网站在本地机器和测试服务器上运行良好,但是一旦我们单击生产服务器上的链接按钮,它就会挂起。
这个问题在 Chrome 中不存在,在 FireFox 中它只存在于 IE9 中。当您将 IE9 置于兼容模式时,它不存在。
如果我使用 IE9 Developer 工具栏并观看脚本,只要您单击其中一个链接按钮,控制台就会显示此错误:
SCRIPT28: Out of stack space , line 340 character 9
SCRIPT28:堆栈空间不足,第 340 行字符 9
- I am using quite a bit of JQuery and am wondering if this is causing an issue: However, I see no javascript errors.
- 我正在使用相当多的 JQuery 并且想知道这是否会导致问题:但是,我没有看到 javascript 错误。
Any thoughts? Thanks for any suggestions.
有什么想法吗?感谢您的任何建议。
回答by dmitry
As people said in comments: it means that infinite recursion takes place. Whether it is simple recursion or some devious path across code like a serpent biting its tail - unknown, it seems IE gives out no stacktrace, or does?
正如人们在评论中所说:这意味着发生了无限递归。无论是简单的递归还是一些像蛇咬尾巴一样的跨代码的迂回路径 - 未知,IE似乎没有给出堆栈跟踪,或者是吗?
回答by Ahmad AlMughrabi
I've reproduced this issue when I'm doing the following code:
我在执行以下代码时重现了这个问题:
HTML
HTML
<span class="search-icon"><input title="search" type="submit" value=""></span>
JS
JS
(function($) {
$('.search-icon').on('click', function(e) {
// The click event will call $('.search-icon').on('click', function(e) { .. } for every time
// which make an infinte loop in click event as long as there are no stop condition added here.
$(this).find('input').click();
});
})(jQuery);
I've solve this problem by changing my JS code to be:
我通过将我的 JS 代码更改为:
(function($) {
$('.search-icon').on('click', function(e) {
$(this).closest('form').submit();
});
})(jQuery);
I hope this answer will be helpfull for you.
我希望这个答案对你有帮助。
回答by ledlogic
Can you post the code / a link to the code, or close this issue?
您可以发布代码/代码链接,或关闭此问题吗?
Common problems: you might have a closure problem in the html, thus different browsers interpret the html hierarchy differently, or you might be looping through a for(x in y) where x contains a backreference to y.
常见问题:您可能在 html 中存在闭包问题,因此不同的浏览器对 html 层次结构的解释不同,或者您可能正在遍历 for(x in y),其中 x 包含对 y 的反向引用。
回答by Nick Rolando
Check out the msdn pagefor info on this error. In my case, the error was caused by:
查看msdn 页面以获取有关此错误的信息。就我而言,错误是由以下原因引起的:
Your code triggered an event cascade.
An event cascade is caused by triggering an event that calls an event procedure that's already on the stack. ...
您的代码触发了事件级联。
事件级联是由触发调用已经在堆栈上的事件过程的事件引起的。...
Basically, I was trying to trigger a click event (using jQuery) on a file upload control using the control's click event. Seems like it would cause infinite recursion. Perhaps you may be having a similar problems with your buttons.
基本上,我试图使用控件的 click event在文件上传控件上触发 click 事件(使用 jQuery)。似乎它会导致无限递归。也许您的按钮可能有类似的问题。