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
loading...
About Hardono
Incoming Search
chrome, extensions, javascript