-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
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.