I have a content script running in all frames.
Something happens in one of the iframes and it sends message to the parent frame. At that time I have the iframe frameId
, but now I need to find the iframe element in the main html that belongs to it.
One way that could work is to find iframe based on src
attribute - which should be equal to sender.url
in the browser.runtime.onMessage
message sender handler.
But it feels too fragile.
Is there a better way?