问题描述
在后台js:
chrome.tabs.onActivated.addListener((activeInfo)=>{
var tabId=activeInfo.tabId;
console.log("tab switched: "+tabId);
chrome.tabs.get(tabId,(tab)=>{
console.log("getTabById: "+tab);
});
chrome.tabs.getSelected(null,function(tab) {
console.log("getTabByUsingSelected: "+tab);
});
chrome.tabs.query({"active":true,"currentwindow":true,'lastFocusedWindow': true},(tabs)=>{
if (chrome.runtime.lastError) {
}else{
if(tabs!==undefined){
console.log("getTabByQuery: "+tabs[0].url);
}
}
});
});
清单:
"manifest_version":2
"permissions":[
"storage","activeTab","tabs","<all_urls>"
],"background":{
"scripts": ["background.js"]
},
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)