Search code examples
google-chrome-extension

Problem with getting "matches" section of chrome extension to work


I am making a chrome extension but I only want it to run on youtube. Below is my manifest.json

{
  "name": "video-tracker",
  "description": "YT VID TRACKER",
  "version": "1.0",
  "manifest_version": 2,
  "content_scripts": [
    {
      "matches": ["*://youtube.com/*"],
      "js": ["content.js"]
    }
  ],
  "permissions": ["storage"]
}

I just can't seem to get why it doesn't work. In my content.js I have a simple alert statement. I tried many other sites instead of place of the word "youtube" in the matches section and they all log the alert but its just youtube that won't do it for some reason! Was wondering if any of you guys know why.


Solution

  • Try to large your match with none www and www includes

    "matches": ["*://youtube.com/*", "*://www.youtube.com/*"],