I’m creating a Chrome extension where clicking on its icon in the extension strip will open a popup. I’m iframing my website in this popup; the URL that’s open in the main tab isn’t particularly important for this question. As the user is interacting with the iframed website, it’ll trigger logic in the extension, and I want to have the Chrome extension be able to modify the contents of the iframed website. Of course, when I tried to do this the naive way by having the extension code try to get info about the iframe, I can’t because of the cross-origin nature.
I think this is possible, since I see questions like this one and its linked answers. But I’m confused as to what sort of script I need to put on which website vs the extension, and also how things might be different with Chrome extension manifest version 3.
My rough sense of what I need to do is:
- Create a content script to embed into the iframed website?
- When desired, have my Chrome extension send a signal/message which the content script in the iframed website can catch?
Is that correct, or do I need to go some other path?