首页 新闻 赞助 找找看

Web前端:如何设置当前页面所有请求的默认超时时间

0
悬赏园豆:30 [待解决问题]

这样可以让某些执行慢的请求直接超时,包含图请求,ajax请求等。

js
dudu的主页 dudu | 高人七级 | 园豆:31094
提问于:2015-09-25 13:44
< >
分享
所有回答(2)
0
<system.web>
<httpRuntime maxRequestLength="1024" executionTimeout="20" />
</system.web>

 

设置下web.config

请叫我头头哥 | 园豆:9382 (大侠五级) | 2015-09-25 14:11

图片?

支持(0) 反对(0) 爱编程的大叔 | 园豆:30839 (高人七级) | 2015-09-25 15:17

是在客户端进行设置

支持(0) 反对(0) dudu | 园豆:31094 (高人七级) | 2015-09-25 15:30

@dudu: 就是设置浏览器超时时间?

你试试这个办法。

1. 单击“开始”,单击“运行”,键入 regedit,然后单击“确定”,cheap chanel handbag。 

2. 在注册表中找到并单击以下项:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings

3. 在“编辑”菜单上,假期OVER,指向“新建”,然后单击“DWORD 值”。

4. 键入 KeepAliveTimeout,然后按 Enter 键。

5. 在“编辑”菜单上,单击“修改”。

6. 键入相应的超时值(以毫秒为单位),然后单击“确定”。

例如,要将超时值设置为两分钟,请键入 120000。

7. 重新启动 Internet Explorer。

支持(0) 反对(0) 请叫我头头哥 | 园豆:9382 (大侠五级) | 2015-09-25 16:17

@爱编程的大叔: 意会错了, du老板要的是客户端的。

支持(0) 反对(0) 请叫我头头哥 | 园豆:9382 (大侠五级) | 2015-09-25 16:17

@请叫我头头哥: 要通过js代码实现,不允许操作客户端电脑

支持(0) 反对(0) dudu | 园豆:31094 (高人七级) | 2015-09-25 20:55
0

如果是Jquery的话,可以看看这个

http://api.jquery.com/jQuery.ajax/

timeout
Type: Number
Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only,script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period.
 
中间加黑斜线的,链接过去其实是没有有关timeout的说明,不过我想DUDU是可以找出怎么办的。
也就是说, JQuery是可以设置全局timeout的,然后局部可以Override。
爱编程的大叔 | 园豆:30839 (高人七级) | 2015-09-25 16:41
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册