开发者

jQuery History.js:about statechange event trigger due to browser forward and backward button

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开发者_Python百科, 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜