T.Todua
T.Todua

Reputation: 56555

Chrome extension permission for specific site, WITH all it's subdomains and extensions

i.e. I want extension to give permissions only for specific company sites, like:

www.google.co.uk
xyz.google.com
etc...

I've tried:

"*://*.google.*/"

but it chrome gives errors in extensions page, saying:

Permission '*://*.google.*/' is unknown or URL pattern is malformed.

Upvotes: 3

Views: 3382

Answers (1)

OroshiX
OroshiX

Reputation: 714

With the 3rd version of the manifest, the host permissions have now changed location, as seen in the migration guide.

It seems that the current documentation for webRequests is not yet up to date, so if you do it the old way, the error Permission [...] is unknown or URL pattern is malformed will appear.

So now, instead of the old way:

// Manifest v2
"permissions": [
  "tabs",
  "bookmarks",
  "http://www.blogger.com/",
],
"optional_permissions": [
  "*://*/*",
  "unlimitedStorage"
]

You need to adopt the new way:

// Manifest v3
"permissions": [
  "tabs",
  "bookmarks"
],
"optional_permissions": [
  "unlimitedStorage"
],
"host_permissions": [
  "http://www.blogger.com/",
  "*://*/*"
],

Upvotes: 3

Related Questions