browse by category or date

Today I had an idea for a Chrome extension project. So after work, I re-learning again on how to create a Chrome extension. As I was tinkering with the code, I encountered this error:

Uncaught (in promise) Error: Cannot access contents of url “https://developer.chrome.com/docs/extensions/reference/permissions/”. Extension manifest must request permission to access this host.

To solve this problem, we need to update the manifest.json. If you are using manifest version 2 (V2), you need to add url patterns into optional_permissions.

V2 Manifest

{
  "name": "My extension",
  "manifest_version": 2,
  ...
  "optional_permissions": ["http://*/", "https://*/"], 
  ...
}

If you are using manifest version 3 (V3), you need to add it to host_permissions instead.

V3 Manifest

{
  "name": "My extension",
  "manifest_version": 3,
  ...
  "host_permissions": ["http://*/", "https://*/"], 
  ...
}

That’s all folks!

Reading material: chrome.permissions

GD Star Rating
loading...
Chrome Extensions Error: Cannot access contents of url. Extension manifest must request permission to access this host. [SOLVED], 5.0 out of 5 based on 1 rating

Possibly relevant:

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Incoming Search

chrome, extensions, javascript

No Comment

Add Your Comment