lsc 3 weeks ago
parent
commit
d772abc8a3
1 changed files with 4 additions and 14 deletions
  1. 4 14
      js/Desktop/Onload.js

+ 4 - 14
js/Desktop/Onload.js

@@ -44,12 +44,12 @@ window.onload = function () {
     //     // window.location.reload();
     // })
 
-    window.addEventListener('beforeunload', function (event) { 
+    window.onbeforeunload = function (event) { 
         // 阻止默认行为 
         event.preventDefault(); 
         event.returnValue = ''; 
         // / 对某些浏览器有效 
-    });
+    }
 }
 
 US.Config = {
@@ -679,12 +679,7 @@ U.MD.D.getuser = function () {
     }
     var _cookie = U.UF.Cookie.get("cocorobo");
     if(LoginState && !_cookie){
-        window.removeEventListener('beforeunload', function (event) { 
-            // 阻止默认行为 
-            event.preventDefault(); 
-            event.returnValue = ''; 
-            // / 对某些浏览器有效 
-        });
+        window.onbeforeunload = null
         window.location.reload();
     }else if(LoginState && !CookieS){
         CookieS = _cookie
@@ -707,12 +702,7 @@ U.MD.D.getuser = function () {
 
                 }, [], { "type": "GET", "withCredentials": true });
             }else {
-                window.removeEventListener('beforeunload', function (event) { 
-                    // 阻止默认行为 
-                    event.preventDefault(); 
-                    event.returnValue = ''; 
-                    // / 对某些浏览器有效 
-                });
+                window.onbeforeunload = null
                 window.location.reload();
             }
         }, [], { "type": "GET", "withCredentials": true });