We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I wrote some testing code about host permissions for current Chrome and Edge stable version:
I found some inconsistency, it may also mislead users to know the actual host permissions are required/granted by the extension.
content_scripts
This imply required host permissions:
{ "manifest_version": 3, "name": "mv3", "version": "0.1.0", "content_scripts": [ { "matches": [ "https://www.youtube.com/*" ], "js": [ "youtube.js" ] } ] }
Chrome:
Edge:
Edge's "on all sites" makes it seem like extensions require any host permissions.
host_permissions
Runing chrome.scripting.registerContentScripts() in backgroud.js
chrome.scripting.registerContentScripts()
{ "manifest_version": 3, "name": "mv3", "version": "0.1.0", "permissions": [ "scripting" ], "host_permissions": [ "https://www.youtube.com/" ], "background": { "service_worker": "background.js", "type": "module" } }
The same as "Defined in content_scripts"
optional_host_permissions
After first-install, use chrome.permissions.request() to grant the permission.
chrome.permissions.request()
{ "manifest_version": 3, "name": "mv3", "version": "0.1.0", "permissions": [ "scripting" ], "optional_host_permissions": [ "https://www.youtube.com/" ], "options_page": "options.html", "background": { "service_worker": "background.js", "type": "module" } }
Chrome on first-install:
Chrome after grant:
Edge on first-install:
Edge after grant:
Even Edge is chromium-base browser, it has difference behavior than Chrome.
Currently I prefer Safari behavior:
So for users, host_permissions just the same as optional_host_permissions, they are optional at runtime.
But developers still can use host_permissions to add some extra behaviors:
required-icon
The text was updated successfully, but these errors were encountered:
Feel free to fire Browser specific issue (or cross reference from here). This is for Microsoft Edge - https://github.com/microsoft/MicrosoftEdge-Extensions/
Sorry, something went wrong.
No branches or pull requests
I wrote some testing code about host permissions for current Chrome and Edge stable version:
I found some inconsistency, it may also mislead users to know the actual host permissions are required/granted by the extension.
1. Defined in
content_scripts
This imply required host permissions:
Chrome:
Edge:
Edge's "on all sites" makes it seem like extensions require any host permissions.
2. Defined in
host_permissions
Runing
chrome.scripting.registerContentScripts()
in backgroud.jsChrome:
Edge:
The same as "Defined in content_scripts"
Defined in
optional_host_permissions
After first-install, use
chrome.permissions.request()
to grant the permission.Chrome on first-install:
Chrome after grant:
Edge on first-install:
Edge after grant:
Even Edge is chromium-base browser, it has difference behavior than Chrome.
Currently I prefer Safari behavior:
So for users,
host_permissions
just the same asoptional_host_permissions
, they are optional at runtime.But developers still can use
host_permissions
to add some extra behaviors:required-icon
on the listing host items, to warn users: "if you disallow it, you maybe break the extension".The text was updated successfully, but these errors were encountered: