Hello all i want to load the script whether or not user clicks on my extension icon This is my extension it works great but i want it to work without making the user click o
if (typeof jQuery === 'undefined') {}
What executeScript
does is basically creating a Content Script dynamically. This is called Programmatic Injection.
An alternative method of working with content scripts is specifying them in the manifest. This achieves exactly what you're asking: content scripts are executed automatically when the page is loaded.
"content_scripts" : [
{
"js": ["jquery.js", "inject.js"],
"matches": ["*://*/*"]
}
],
Adjust the matches
parameter to only include match patterns for pages you want it to run on.
Make sure to check out the documentation of run_at
parameter if you need to fine-tune when injection happens.