Hello everyone,
I have an extension published on the CWS. In the next update I'm adding a content script, and unfortunately I didn't require host permissions before, which means it'll be disabled for users that have already installed it.
I tried using `scripting.executeScript` each time a tab is loaded:
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (tab.url?.startsWith('chrome://')) return;
if (changeInfo.status === 'complete') {
chrome.scripting.executeScript({
target: { tabId },
files: ['my-content.js'],
});
}
});
But I receive this error: "Error: Cannot access contents of the page. Extension manifest must request permission to access the respective host."
Is there a way to use a content script with optional host permissions or something similar that prevents the extension from getting disabled?