瀏覽代碼

https/http redirect fix

Vijayakrishnan 3 年之前
父節點
當前提交
e039d0e32f
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      public/js/mc.js

+ 9 - 2
public/js/mc.js

@@ -229,8 +229,6 @@ function fastLoad(_href, _history = true, _useCache = true, _replaceState = fals
     showMask();
 
     if (_href === '') _href = '/';
-    if(_href.length > 1 && _href[_href.length - 1] === '/') _href = _href.substr(0, _href.length - 1);
-    _href = _href.replace('/?', '?');
 
     // push state
     if (_history) {
@@ -253,6 +251,15 @@ function fastLoad(_href, _history = true, _useCache = true, _replaceState = fals
     if (_useCache && !!fastCache[_href]) {
         onFastLoaded(fastCache[_href], _href, _history);
     } else {
+
+        let cleanedHREF = _href;
+        if(cleanedHREF.length > 1 && cleanedHREF[cleanedHREF.length - 1] === '/') {
+            cleanedHREF = cleanedHREF.substr(0, cleanedHREF.length - 1);
+        }
+        if(cleanedHREF.length > 2) {
+            cleanedHREF = cleanedHREF.replace('/?', '?');
+        }
+
         $.get(_href, function (_data) {
             onFastLoaded(_data, _href, _history);
         }).fail(function (_jqXhr) {