From 4b201cb661909a2663b8f94fe9f7b27dca33c287 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 27 Jan 2016 17:42:10 +0100 Subject: try to cope with timeouts [not working] --- js/common.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- cgit v1.2.3