diff --git a/src/main/java/org/olat/core/gui/control/winmgr/_content/serverpart.html b/src/main/java/org/olat/core/gui/control/winmgr/_content/serverpart.html index fad15b0fddbdd73dcb10c5b519a2bd1b0277135a..0e9fc7fdb05b770822d404dcda4e9c39966dad36 100644 --- a/src/main/java/org/olat/core/gui/control/winmgr/_content/serverpart.html +++ b/src/main/java/org/olat/core/gui/control/winmgr/_content/serverpart.html @@ -95,7 +95,24 @@ function tick () { if (ts > sbtimestamp) { window.onunload=null; window.onbeforeunload=null; - window.location='$sburi/'; + ## First probe if the standby window mapper is available + jQuery.ajax({ + method:'get', + url:'$sburi/', + cache: false, + success:function() { + ## OK, so redirect to standby + window.location='$sburi/'; + }, + error: function() { + ## NOK: standby not available. This happens when the other opened window can not be detected + ##Â (e.g. in other browser or loaded from a bookmark etc). Normally this is already done by onPollFailure, + ## but this does not catch all cases. + ##Â Only solution: stop poller as this triggers some fancy ***.dms file downloads + o_info.poller.cancel(); + } + })(); + } } catch (e) { // does not matter @@ -127,8 +144,14 @@ function onPollSuccess(content, s, response) { } } -function onPollFailure() { +function onPollFailure(response) { pollError++; + if(response.status == 404) { + ## Not found - happens when user opened a second window and logged in while in the first window the poller is still running. + ##Â Note: when in standby-mode this does not happen as the user session is still valid and the standby document exists. + ##Â Only solution: stop poller as this triggers some fancy ***.dms file downloads + o_info.poller.cancel(); + } } /* ]]> */ </script>