I
I
iDrugov2017-01-27 10:22:42
Mobile development
iDrugov, 2017-01-27 10:22:42

How to determine the true height of a viewport in an iframe?

I make an application in VK, when it opens - VK in iframe passes the first received value of height and width. At the same time, it indicates the height in pixels. For example, when opening an app in landscape mode on an iPhone 5, the iframe will be set to height: 320px. Then, if the smartphone is rotated to a vertical position, the height value will remain unchanged, therefore, everything that is inside is cut off.

$(window).outerHeight(); also returns the first received iframe height, and I don’t know how to request the height of the elements located above the iframe.

Reload the iframe every time the phone is rotated, I think the idea is so-so.

And I don't seem to be able to resize the iframe either.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Whitesunset, 2017-01-28
@Whitesunset

Try this option

window.onresize = function(){console.log(screen.height)}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question