我試圖嘲笑從網頁的超時,以便我可以實現「處理超時」功能。模擬超時url
基本上我需要的是一些在X秒內不回覆的東西的網址。
在此先感謝
這裏是我的代碼:
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);
難道你們就不能只是包裝的AJAX回報函數在'setTimeout()'裏面? – BenM
@BenM這正是我想要做的,但要測試它,我需要一個URL,肯定會超時,這就是我所追求的。 – ricardoespsanto
請將您正在討論的代碼添加到問題中。 – AD7six