The following iframe is embedded on https://third-party-site.com:
<iframe src="https://example.com/widget" />
https://example.com/widget is rendering dynamic content and I'd like to set iframe's height according to content's height to avoid having a scrollbar.
How could I get the iframe element from the widget page where the content is rendered?
window.frameElement unfortunately returns null because the domains are different:
If the window isn't embedded into another document, or if the document into which it's embedded has a different origin, the value is null instead.
Trying to access the iframe inside iframe's onload results in:
Uncaught DOMException: Blocked a frame with origin "https://third-party-site.com" from accessing a cross-origin frame.