Parcourir la source

Avoid back button return using history

Jérôme BUISINE il y a 4 ans
Parent
commit
2e45c28326
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. 6 0
      static/js/keyEvents.js

+ 6 - 0
static/js/keyEvents.js

@@ -58,3 +58,9 @@ const checkKey = e => {
 
 // implement `key` events
 document.addEventListener('keydown', checkKey)
+
+
+// avoid back button return 30 times... (Need to improve this..)
+for (var i = 0; i < 30; i++){
+   window.history.pushState({isBackPage: false, }, document.title, location.href)
+}