-
Could you tell me the difference between Regards, wxt for example: export default defineBackground({
main() {
console.log('Hello background!', { id: browser.runtime.id });
browser.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
if (status === 'complete' && isTestPage(url)) {
await (browser.action ?? browser.browserAction).enable(tabId);
// >>>>>>>TODO: how to inject content script? (main world needed)
} else {
await (browser.action ?? browser.browserAction).disable(tabId);
}
});
},
}); |
Beta Was this translation helpful? Give feedback.
Answered by
aklinker1
Jun 4, 2024
Replies: 1 comment 3 replies
-
Unlisted scripts aren't added to the manifest. Content scripts are listed in the manifest and are automatically registered to run in tabs. You can use the |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
xunziheng
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unlisted scripts aren't added to the manifest. Content scripts are listed in the manifest and are automatically registered to run in tabs.
You can use the
scripting
API to run code in a tab whenever you want: https://developer.chrome.com/docs/extensions/reference/api/scripting#concepts_and_usage