Browse Source

Minor improvement of websocket handling

Alexey Edelev 5 years ago
parent
commit
9c5168a9ce
1 changed files with 5 additions and 2 deletions
  1. 5 2
      web/js/index.js

+ 5 - 2
web/js/index.js

@@ -520,9 +520,12 @@ function connectNotifier() {
     }
     }
 }
 }
 
 
-window.onbeforeunload = function() {
+$(window).on('beforeunload', function(){
     if (notifierSocket != null) {
     if (notifierSocket != null) {
-        notifierSocket.onclose = function () {}; // disable onclose handler first
         notifierSocket.close();
         notifierSocket.close();
+        notifierSocket = null
     }
     }
+});
+
+window.onbeforeunload = function() {
 };
 };