I have a manifest.json file like this:
{
\"name\": \"YouTube Trending to Paid promotion!\",
\"manifest_version\": 2,
\"version\": \"1.0\",
The problem, as the error states, is that your matches value is invalid. The Match Patterns documentation explains that *, when used in the host portion, has the following requirements:
*in the host can be followed only by a.or/
If*is in the host, it must be the first character
Thus, your match pattern of:
"matches": ["*://*.youtube.*/*"],
is invalid because the second * (youtube.*) is not permitted.
You need to explicitly determine the TLDs you desire to match, then include a list of them in your matches array. For example:
"matches": [
"*://*.youtube.com/*",
"*://*.youtube.co.uk/*"
],
However, for YouTube, they appear to redirect all traffic to youtube.com. Thus, you are probably just fine using:
"matches": ["*://*.youtube.com/*"],
This matching limitation is by design. There are a large number of TLDs, and more are likely to be created in the future. There is no guarantee that a particular site which you desire to match currently has a domain in every TLD, nor that they will obtain one in every new TLD which is created. Thus, the better solution is to not permit wildcards for the TLD when a portion of the host is specified.
include_globs, but then have possible false matchesYou can use include_globs to obtain what you desire, but doing so has security risks due to possible false matches. You would need something like:
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["popup.js"],
"include_globs": [
"http://*.youtube.*/*",
"https://*.youtube.*/*"
]
}
]
This is still imperfect, as it will match URLs which contain .youtube.*/* anywhere in their URL (e.g. http://foo.example.com/clone/www.youtube.com/myVideo). Unfortunately, because include_globs is a glob, not a full regular expression, you can not specify that you want to match all characters but /, which you could do in a regular expression (e.g. [^/]). Overall, you are better off explicitly determining the TLDs you desire to match, then include a list of them in your matches array.
Note: In the above example, your matches pattern could be either "*://*/*", or "<all_urls>". The difference is that "<all_urls>" also matches "file:" and "ftp:" URLs, which are then excluded by the include_globs.
Seems Content Script matches are slightly different.
See the matterns are allowed in chrome https://developer.chrome.com/extensions/match_patterns
"content_scripts": [
{
"matches": ["*://*.youtube.com/*"],
"js": ["popup.js"]
}
]
or use "matches": ["<all_urls>"]
Refer : Chrome Extension Manifest 'Matches' already discussed by stackoverflow.