Skip to content Skip to sidebar Skip to footer

Chrome Extension To Load The Script Without Clicking On Icon

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 on the i

Solution 1:

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.

Solution 2:

if (typeof jQuery === 'undefined') {}

Post a Comment for "Chrome Extension To Load The Script Without Clicking On Icon"