]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/commitdiff
Periodically attempt to load server script until it succeeds
authorMichal Sojka <michal.sojka@cvut.cz>
Mon, 6 Aug 2018 15:34:46 +0000 (17:34 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Mon, 6 Aug 2018 15:34:46 +0000 (17:34 +0200)
html/index.html

index a1c07d0f7a94c7cb742ec40868db1fe32a77483c..ad6ec0a32cc916feb143c82d67e0fd65d2a83b6f 100644 (file)
@@ -1,8 +1,19 @@
 <!doctype html>
 <html>
-<title>Merica Terminal</title>
-<script type="text/javascript" src="//dejvice.merica.cz:5000/js" async></script>
+<title>IID Coffee Terminal</title>
 <script>
+    function loadServerScript() {
+       let script = document.createElement('script');
+       script.src = "//localhost:5000/js";
+       document.head.append(script);
+       script.onerror = function() {
+           this.parentElement.removeChild(this);
+           setTimeout(loadServerScript, 10000);
+       };
+    }
+
+    loadServerScript();
+
     var socket;
 
     function connect() {