-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
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
manifest key to enable automatic injection of content scripts after installation/update #617
Comments
Very much in favour of having this be aligned cross browsers! Safari also injects content scripts right after installation. As for the possible solutions. More in favour of 2-4. As 1; using an array for "run_at" would not be backwards compatible. Mixing the two also seems confusing rather than clarifying. |
This is also something I wrote some code for (https://github.com/fregante/webext-inject-on-install) but it requires the Related requests:
Here's what they could look like: {
"content_scripts": [{
"id": "main",
"matches": ["*://*.example.com/*"],
"scripts": ["content.js"],
"run_at": "document_idle",
+ "run_on_active_tab": true,
+ "run_on_extension_enabled": true
}]
} or {
"content_scripts": [{
"id": "main",
"matches": ["*://*.example.com/*"],
"scripts": ["content.js"],
"run_at": "document_idle",
+ "run_on": ["active_tab", "extension_enabled"]
}]
} or combine it with {
"content_scripts": [{
"id": "main",
"matches": ["*://*.example.com/*"],
"scripts": ["content.js"],
+ "run_at": ["document_idle", "active_tab", "extension_enabled"]
}]
} |
In addition to injection. There is also the removal aspect in case content scripts get registered using registerContentScripts as mentioned in #653. So we might want to come up with a different naming which also includes the above mentioned behaviour of removing already injected styles (not applying to scripts as injected scripts can not be reversed). |
Benefits/goals:
matches
inhost_permissions
and doesn't supportexclude_matches
yet (#123).Possible solutions:
"run_at": ["document_start", "extension_installed", "extension_enabled"]
i.e. an alternative array syntax forrun_at
"run_at_extension": ["installed", "enabled"]
i.e. an additional key"run_at_installed": true
and"run_at_enabled": true
"run_at_installed_or_enabled": true
Notes:
"extension_invoked"
in 1,"invoked"
in 2,"run_at_invoked"
in 3 and 4.content_scripts
should copy the install note from MDN concepts.content_scripts
.The text was updated successfully, but these errors were encountered: