javascript - 模拟超时 url

标签 javascript timeout

我正在尝试从网页模拟超时,以便我可以实现“处理超时”功能。

基本上我需要的是一个在 X 秒内不回复的东西的 URL。

提前致谢

这是我的代码:

var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
req.overrideMimeType('text/plain; charset=utf-8');
req.open("GET", configurationURL, false);
req.variable = specificConfigurationURLTerminator;
setTimeout(function() {
    alert("aborting");
    req.abort();
}, this.configurationRetrievalTimeout);
req.send(null);

最佳答案

非常感谢你们的及时回复。我找到了我要找的东西:

http://www.google.com:81/

即使有错误也基本上不响应 =) 正是我需要触发超时

关于javascript - 模拟超时 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14501905/

相关文章:

javascript window.open _blank 地址栏已锁定

javascript - 自动执行括号会导致 setInterval 出现问题?

Scala future 序列和超时处理

c# - Silverlight 套接字中的超时

c++ - 类似于 c++ 的 setTimeout 功能

javascript - 不会对表列 jQuery 求和

javascript - AngularJs "controller as"语法 - 澄清?

javascript - 我什么时候应该使用返回?

python - Python X 秒后超时

.net - 如何解决间歇性 SQL 超时错误