0
我試圖在google play store的內容腳本中使用history.js,但在狀態更改時不執行該功能 我嘗試了清單中的適配器綁定方法 :History.js在內容腳本中不起作用
"js": [
"js/jquery/jquery.js",
"js/jquery.knob.js",
"js/jquery.history.js",
"src/inject/inject.js"
]
,然後在內容腳本
History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate
var State = History.getState(); // Note: We are using History.getState() instead of event.state
alert();
});
以及沒有任何反應
而且該解決方案不起作用EIT她
(function(history){
var pushState = history.pushState;
history.pushState = function(state) {
if (typeof history.onpushstate == "function") {
history.onpushstate({state: state});
}
// ... whatever else you want to do
// maybe call onhashchange e.handler
return pushState.apply(history, arguments);
}
})(window.history);
history.onpushstate=function(){alert()}
我想這可能是與其中的內容腳本運行