Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To have a Chrome extension show up automatically upon visiting a specific website, you can use the content script feature of Chrome extensions.

  1. Open your extension's manifest.json file.

  2. Add the "content_scripts" field and configure it to match the URL of the website where you want your extension to show up.

Example:

"content_scripts": [
   {
      "matches": ["https://www.website.com/*"],
      "js": ["content_script.js"]
   }
]

Here, the "matches" field specifies the URL pattern to match and the "js" field specifies the name of the JavaScript file that contains your content script.

  1. Create your content script file (e.g. content_script.js) and add the logic for your extension to execute on the specified website.

Example:

if (window.location.href.includes("https://www.website.com/")) {
   // extension logic here
}
  1. Save your changes and reload your extension to see it automatically appear when you visit the specified website.