From 95c36d60adf6b5c169886ff671b7470c7340a643 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Tue, 22 Dec 2020 21:48:02 +0000 Subject: [PATCH] fhemweb.js: iOS fix, version#2 (Forum #116962) git-svn-id: https://svn.fhem.de/fhem/trunk@23406 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/www/pgm2/fhemweb.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js index 16eb0f065..b0f33e349 100644 --- a/fhem/www/pgm2/fhemweb.js +++ b/fhem/www/pgm2/fhemweb.js @@ -555,6 +555,7 @@ FW_csrfRefresh(callback) }); } +var FW_cmdStack=[]; function FW_cmd(arg, callback, rep) { @@ -573,13 +574,16 @@ FW_cmd(arg, callback, rep) callback(req.responseText); else if(req.responseText) FW_errmsg(req.responseText, 5000); + var todo = FW_cmdStack.shift(); + if(todo) { + log("FW_cmd retry #"+todo.rep); + FW_cmd(todo.arg, todo.callback, todo.rep); + } }, error:function(xhr, status, err) { // iOS 13+ is not queueing requests, have to do it myself. Forum #116962 if(xhr.status == 0 && xhr.readyState == 0 && (!rep || rep < 10)) { - rep = (rep ? rep+1 : 1); - log("FW_cmd retry #"+rep); - setTimeout(function(){FW_cmd(arg, callback, rep)}, 200); + FW_cmdStack.push({ arg:arg, callback:callback, rep:(rep?rep+1:1)}); } else if(xhr.status == 400 && typeof FW_csrfToken != "undefined") { FW_csrfToken = "";