Using an extension, I'd like to measure the offset of an iframe (relative to the top window) when a specific event happens in it. This includes iframes of different origins.
It seems to require two things:
- catching the event in the iframe's own content-document
- finding the iframe's corresponding DOM element (
<iframe>
) in its parent window and measuring its offset
I can run a content-script in all iframes which would catch the specific event, but I fail to identify an iframe's corresponding DOM element in iframes with different origins, since in those cases I'm denied access to 'window.frameElement'.
Any ideas? I could perhaps look for an element with an 'src' attribute corresponding to 'window.location.href' as seen in the context of the iframe's content-script, but 'window.location.href' wouldn't be a unique identifier... or would it?