I have a div inside an iframe (no problems with origin policy as both the documents are from same application/domain). I need to figure out the distance of the div from parent window top. The iframe also has scrollbar, so that's one thing to consider too.
I can't produce a semi-working jsfiddle because of the cross origin policies (iframe.contentWindow won't be available), but here's the non-working fiddle anyway.
I have an embedded iframe in the fiddle:
<iframe src="https://noc2spam.github.io/embed.html?ddd" style="display:block; border:0; width:300px; height:200px; overflow:scroll"></iframe>
The following screenshot might give you an idea of what I exactly need.
I have already tried some of the answers which do not seem work for iframes. As for example, this does not work. What is the most convenient way of doing this?