Chrome extension to load the script without clicking on icon

后端 未结 2 1698
鱼传尺愫
鱼传尺愫 2021-01-17 05:41

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

相关标签:
2条回答
  • 2021-01-17 05:52

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

    0 讨论(0)
  • 2021-01-17 06:09

    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.

    0 讨论(0)
提交回复
热议问题