-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
MV3 example for getting data from page/content script/activeTab context into action / popup #533
Comments
It looks like this is your first issue. Welcome! 👋 One of the project maintainers will be with you as soon as possible. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct. |
Hello @wesinator, thanks for the issue. I was wondering if you've had a chance to check the existing examples on MDN. They might have some relevant / useful implementations: I wanted to check with you on this before triaging and prioritizing this work. Let me know if you've already looked into these and whether they are of any help. Thanks! |
Hi @dipikabh I have looked at them , thanks! The "use case" I'm describing here is not captured by any of the existing ones or API examples from what I've seen. I started an example at https://stackoverflow.com/questions/19758028/chrome-extension-get-dom-content/76708728#76708728 that can parse the active tab DOM upon clicking a button in the popup, and then display the content to a popup. I couldn't figure out how to get the output of a function from a contextMenu extension passed to a popup - this may be a browser/webextensions limitation. See w3c/webextensions#160 (comment) Regards, |
What information was incorrect, unhelpful, or incomplete?
It doesn't seem like there is a concrete example of an extension that gets text/data from the page (
activeTab
) using a background or content script, and displays that data (or the output of a transformation on the data) in the extension's browser or page action popup.Presumably this can be done using
runtime.sendMessage
to pass data from the content script to the action, but there isn't a concrete functioning example, and StackOverflow answers for how to do this are sparse and incomplete.What did you expect to see?
An up-to-date, MV3 example that parses data on the activeTab page/DOM using a background or content script (e.g.
scripting.executeScript()
), and displays that data in the extension action popup, using message passing to get the data from the background/content script to the extension action page.Do you have any supporting links, references, or citations?
https://stackoverflow.com/questions/19758028/chrome-extension-get-dom-content is an example of this, but it doesn't have a working MV3 example in the answers that passes the output/data to the extension browser/page action popup.
Do you have anything more you want to share?
Use cases: I have at least two addons that I'm trying to figure out how to do this.
One is a background context menu addon that does manipulation on selected text: I want to display the output in the browser action popup.
The other is an extension that would find certain elements in the page and offer text transformations on them in the browser action popup.
The text was updated successfully, but these errors were encountered: