我刚刚在我的jQuery Ajax应用程序中集成了History.js,但我无法找到区分由于History.pushState而引起的状态更改事件和用户单击浏览器的后退和前进按钮(在这两种情况下,事件都会被触发)的方法。
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);
那么我该如何实现这个目标呢?
istory.Adapter.bind(window,'statechange',function(){})
甚至不会调用,我使用的是1.7.1版本。我在这里发布了一个问题,请你看一下:https://dev59.com/U3HYa4cB1Zd3GeqPJkh5 - Thang Pham