Ronny
Ronny

Reputation: 97

Get the height of browser viewport from iframe using jquery

My web-site is loaded in iframe on another web-page (the domains are different). On the page which is loaded in iframe I need to get the height of browser viewport.

I tried to use $(window).height(); but it returns the height of my iframe as if I used $(document).height(). screen.height doesn't fit either because it returns the height of the whole monitor screen.

P.S. I'm trying to place the modal window vertically in the middle of the viewed part of my iframe, NOT in the middle of the whole iframe, as its height is more then 3000px.

Upvotes: 1

Views: 2072

Answers (1)

kimbaudi
kimbaudi

Reputation: 15555

This isn't possible anymore in browsers due to security reasons. But maybe this would help can an cross-domain iframe detect a browser's actual viewport dimensions?

Upvotes: 1

Related Questions