greasemonkeyスクリプト/ opera拡張機能を使用して、次のコードをウェブページに挿入してhistory.pushState
コマンドをトラップするので、いつでも処理を実行できます。pushState
コマンドは後で続行します。history.pushStateを無効にすると、オペラにエラーが発生する
(function(history){
var pushState = history.pushState;
history.pushState = function(state) {
if (typeof history.onpushstate == "function") {
history.onpushstate({state: state});
}
alert('pushstate called')
return pushState.apply(history, arguments);
}
})(window.history);
コードはFF4とChromeで正常に動作しますが、ページがhistory.replaceState
コマンドを呼び出す場合、オペラ11で、私は、次のエラーを取得する:
Uncaught exception: TypeError: 'window.history.replaceState' is not a function
誰も私が修正できる方法を知っています上記のコードはOperaとChromeとFirefoxで動作しますか?
涼しいリソース – user280109