diff options
author | Patrick Simianer <p@simianer.de> | 2016-01-27 17:42:10 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2016-01-27 17:42:10 +0100 |
commit | 4b201cb661909a2663b8f94fe9f7b27dca33c287 (patch) | |
tree | ba514ab0bc06f680363c89505fe895a8231c7af0 | |
parent | df263a673e833a47010f6390546981d7211e7e39 (diff) |
try to cope with timeouts [not working]
-rw-r--r-- | js/common.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/js/common.js b/js/common.js index 4af7cd0..6ccc8ab 100644 --- a/js/common.js +++ b/js/common.js @@ -44,6 +44,10 @@ function trim(s) return s.replace(/(\||\n|\t)/g, " ").replace(/^\s+|\s+$/g, '').replace(/\s+/g, " "); } +function updateProgress (oEvent) { + //alert(oEvent); +} + /* * cross-site request * @@ -52,7 +56,11 @@ function CreateCORSRequest(method, url) { var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { + xhr.addEventListener("progress", updateProgress); xhr.open(method, url, true); + xhr.timeout = 999999999999; + xhr.ontimeout = function () { alert("XHR TIMEOUT"); } + xhr.onerror = function () { alert("XHR ERRROR 1"); } xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8'); } else { xhr = null; |