I'm working on an extension which in MV2 injected runnable scripts into the page.
In MV3 of course we have to execute prepared functions, with injected arguments.
Right now, it seems we can execute a prepared function so that it does something like this:
chrome.scripting.executeScript({
target: { tabId },
func: (code) => {
eval(code)
},
args: ['alert("hello world")']
})
This actually runs!
However, I'm not sure if it would pass review. Can anyone confirm?
To hedge my bets, I'm looking at user scripts.
I've gotten this working, but it seems there is a caveat; a registered user script will only run after a page has loaded, so if the user is already on the page, they have to reload.
Is there a way to have the registered scripts run immediately?
Thanks!