Bladeren bron

location.search should only be parsed if pathname is empty

Raanan Weber 5 jaren geleden
bovenliggende
commit
25b770bfc1
1 gewijzigde bestanden met toevoegingen van 2 en 3 verwijderingen
  1. 2 3
      Playground/js/main.js

+ 2 - 3
Playground/js/main.js

@@ -566,7 +566,7 @@ class Main {
                         exampleList.appendChild(noResultContainer);
                     }
 
-                    if (!location.hash && restoreVersionResult == false) {
+                    if (!location.hash && restoreVersionResult == false && location.pathname === '/') {
                         // Query string
                         var queryString = window.location.search;
 
@@ -1016,12 +1016,11 @@ class Main {
     };
     checkHash() {
         let pgHash = "";
-        if (location.search) {
+        if (location.search && location.pathname === '/' && !location.hash) {
             var query = this.parseQuery(location.search);
             if (query.pg) {
                 pgHash = "#" + query.pg + "#" + (query.revision || "0")
             }
-
         } else if (location.hash) {
             if (this.previousHash !== location.hash) {
                 this.cleanHash();