Selaa lähdekoodia

Ensure back-traversability to /

Vijayakrishnan Krishnan 4 vuotta sitten
vanhempi
commit
3c46cb8e6e
1 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 4 2
      public/js/mc.js

+ 4 - 2
public/js/mc.js

@@ -67,8 +67,8 @@ var findEventHandlers = function (eventType, jqSelector) {
 
 window.top.addEventListener('popstate', function (event) {
     window.setTimeout(function () {
-        if (!event || !event.state) {
-            console.error('No state!');
+        if (!event || (!event.state && event.state !== '')) {
+            console.error('ALIX No state!', event, event.state);
             return;
         }
         var state = event.state;
@@ -245,9 +245,11 @@ function fastLoad(_href, _history = true, _useCache = true, _replaceState = fals
         if(target[0] === '/') target = target.substr(1);
         if(_replaceState) {
             window.top.history.replaceState(target, null, '/mc/' + target);
+            console.log('ALIX replaceState: [' + target + ']');
         }
         else {
             window.top.history.pushState(target, null, '/mc/' + target);
+            console.log('ALIX pushState: [' + target + ']');
         }
     }