Get iframe content's height when domain & protocol match, but subdomain doesn't

Viewed 1163

I'm trying to get the iframe's ( https://booking.yourdomain.com from https://www.yourdomain.com ) content so I can set the height to it. So all the content is visible, like this ( I took the expression from here ):

var booking_iframe = document.querySelector('iframe');

booking_iframe.onload = function() {
    booking_iframe.style.height = booking_iframe.contentWindow.document.body.offsetHeight + 'px';
}

But this fires the following error:

VM389:1 Uncaught DOMException: Blocked a frame with origin "https://www.yourdomain.com" from accessing a cross-origin frame.
    at <anonymous>:1:54

Domains and protocol match, but subdomain doesn't,

Any suggestion?

( If you want to play with de debugger. I created a test.html with just the iframe in the production environment )

-EDIT-

As a workaround: Any idea how to enable the scrolling on the iframe's content? ( tried fixed height and overflow scroll, and scrolling="yes" but won't work )

1 Answers
Related