]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Add check for window.history support.
authorArian Xhezairi <arian@xhezairi.com>
Sun, 30 Apr 2017 19:56:24 +0000 (21:56 +0200)
committerArian Xhezairi <arian@xhezairi.com>
Sun, 30 Apr 2017 19:56:24 +0000 (21:56 +0200)
js/foundation.reveal.js

index d5ab8ec5be4062f4092a1d179cc71dbbae9efc5d..226fd50df78d3a1a2c6203afca7a1b4448f425bf 100644 (file)
@@ -188,10 +188,14 @@ class Reveal {
     if (this.options.deepLink) {
       var hash = `#${this.id}`;
 
-      if (this.options.updateHistory) {
-        history.pushState({}, '', hash);
+      if (window.history.pushState) {
+        if (this.options.updateHistory) {
+          window.history.pushState({}, '', hash);
+        } else {
+          window.history.replaceState({}, '', hash);
+        }
       } else {
-        history.replaceState({}, '', hash);
+        window.location.hash = hash;
       }
     }
 
@@ -574,7 +578,7 @@ Reveal.defaults = {
   /**
    * Update the browser history with the open modal
    * @option
-   * @example false
+   * @default false
    */
   updateHistory: false,
     /**