How does js calculate the correct height of iframe src content? Via instagram

subject
I want to use iframe and introduce it into my web site with instagram. However, the manager was unable to solve the height problem of "calculating" the content

.

Code

<iframe src="https://www.instagram.com/p/BoEDAZMHW2R/embed/" allowtransparency="true" frameborder="0" scrolling="no"></iframe>

the degree can be set, but the height is unpredictable, because the size of the film and movie of the content is completely unknown: https://www.instagram.com/p/B.

.

so I would like to ask whether js has a way to get the content height of SRC and send it back to iframe height ?

what functions or examples can be used?


you can try to get the total width and height of the internal elements of the document after preloading in the onload event of iframe .

then use document.getElementsById ('your iframe'). ContentWindow.document.getElementById (' the elements you need') to get the height of the page elements

Menu