Your question is pretty broad, but let's assume that you have 3 iframes on one page, twitter facebook and gmail, and you want, for arguments sake, a new tweet to pop an alert box in gmail and facebook.
I think you have two (possibly three) options. You could use window.postMessage
to post a message to the parent window, and then have the extension handle the message content in the parent window (e.g. parent.postMessage(message, "*");
. Bear in mind that you can post objects).
Or, your other solution, if I'm correct, is to make use of the chrome extension's background page functionality. (https://developer.chrome.com/extensions/background_pages#details).
I think this snippet seems most relevant to what you want to do (Taken from the above link):
You can communicate between your various pages using direct script calls, similar to how frames can communicate. The extension.getViews method returns a list of window objects for every active page belonging to your extension, and the extension.getBackgroundPage method returns the background page.
There is an example on that page underneath the section I have linked to which I won't copy into here as it's quite large.
Actually, having read through that, it's quite ambiguous as to whether it means pages that the extension is running on, or pages that are contained within the extension itself.
There is also the chrome "Message Passing" function (https://developer.chrome.com/extensions/messaging) which begins with:
Since content scripts run in the context of a web page and not the extension, they often need some way of communicating with the rest of the extension
Bear in mind that if you want the extension to run in any frame other than the parent window, you will need to specify "all_frames": true
in your manifest.json.