javascript - How to use HTML5 history push state instead of window.location.hash? -


now using window.location.hash history management below, how can replace html5 history push state.

        var  statehistory = [];           function changehistory(page) {              var l = statehistory.length,                 state = window.location.hash;              if (l === 0) {                 statehistory.push(state);                         return;             }             if (state === statehistory[l - 2]) {                 statehistory.pop();                    } else {                 statehistory.push(state);                       }          }; 

you can use html5 history pustate function more info......

    function changehistory(page) {             window.history.pushstate({page:""+page},""+page);            }; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -