I just integrated History.js in my jquery Ajax application but I could not find a way how to differentiate statechange event due to History.pushState in my own code and due to user clicking on Browser back and forward button (in both cases the event gets triggered).
History.Adapter.bind(window,'statechange',function(){
var State = History.getState(); //
if (??????) // should be true only when statechange was triggered due to user clickin on Back or Forward button
showHistoryContent(State.data.historyObj);
});
...........
st++
History.pushState({historyObj:dto, state: st}, null, "?state="+st);
So how can I achieve this goal?
There is a discussion about this here: https://github.com/browserstate/history.js/issues/47
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With