Javascript 浏览器超时
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5798707/
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
Browser Timeouts
提问by Splashlin
Do browsers have built in timeouts and if so what are they?
浏览器是否具有内置超时功能,如果有,它们是什么?
I have a page that does an AJAX call on a process that takes at most 5 minutes to run. Someone said browsers timeout after 2 minutes but didn't know if there was any truth to that.
我有一个页面对最多需要 5 分钟运行的进程执行 AJAX 调用。有人说浏览器在 2 分钟后超时,但不知道这是否属实。
采纳答案by haknick
It's browser dependent. "By default, Internet Explorer has a KeepAliveTimeout value of one minute and an additional limiting factor (ServerInfoTimeout) of two minutes. Either setting can cause Internet Explorer to reset the socket." - from IE support http://support.microsoft.com/kb/813827
它依赖于浏览器。“默认情况下,Internet Explorer 的 KeepAliveTimeout 值为一分钟,附加限制因素 (ServerInfoTimeout) 为两分钟。任一设置都可能导致 Internet Explorer 重置套接字。” - 来自 IE 支持http://support.microsoft.com/kb/813827
Firefox is around the same value I think as well.
Firefox 的价值也与我想的差不多。
Usually though server timeout are set lower than browser timeouts, but at least you can control that and set it higher.
通常虽然服务器超时设置低于浏览器超时,但至少您可以控制它并将其设置得更高。
You'd rather handle the timeout though, so that way you can act upon such an event. See this thread: How to detect timeout on an AJAX (XmlHttpRequest) call in the browser?
不过,您更愿意处理超时,这样您就可以对此类事件采取行动。请参阅此线程:如何检测浏览器中 AJAX (XmlHttpRequest) 调用的超时?