-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Reduce to use content scripts #5
Comments
FYI, here is a simplified version of what I actually use for the Copy URL To Clipboard extension. contentScript.js:
executeContentScript.js (import it to the background script):
background.js:
|
Thanks to suggest! Is I want to prevent to read it from page context. |
No, as I noted in the sample, web page cannot see
|
Currently, we have used content scripts for "Console Integration"
webextension/app/manifest.json
Line 21 in 7d1ded1
https://github.com/secretlint/webextension/blob/main/app/scripts/contentScript.ts
This approach always inject content scripts to any website.
Instead of it, we want to use
chrome.scripting.executeScript
, however it does not exists on Firefox.tabs.executeScript()
does not support arguments.(Also we need to inject again when move pages.)
📝 Details of context.
tabs.executeScript({ code })
use dynamiceval
, This is another reason why i avoid.We need to treat it with caution and it will make complex.
tabs.executeScript()
supportfile
but it is not dynamic(no arguments).tabs.executeScript()
supportcode
but it just useeval
.chrome.scripting.executeScript
support freezed function and arguments, but Firefox does not support yet.Related #4
The text was updated successfully, but these errors were encountered: