Chrome扩展manifest V3变化、升级迁移指南_chrome_ZK645945-华为云开发者联盟 (youkuaiyun.com)
1.background
//V2
"background": "background.js"
//V3
"background": {
"service_worker": "background.js"
}
2.executeScript
//V2
chrome.tabs.executeScript({
file: 'script.js'
});
//V3
"permissions": ["scripting"]
async function getCurrentTab() {/* ... */}
let tab = await getCurrentTab();
chrome.scripting.executeScript({
target: { tabId: tab.id },
files: [ 'script.js' ]
});
3.action
browser_action 改
为 action。