Iframe height adjustment

Is there a way to set the height of the iframe to the same as the height of its source?

I'm trying a) Avoid scrollbars and
b) Avoid using fixed height in px

Thanks. :)

+3
source share
3 answers

I think this question was answered before

0
source

Since the source page is in a different domain - no.

The only way to adjust your size based on the content is to measure the display size of the content using JavaScript, and the same origin policy will prevent this.

+1

, iframe-? javascript thingie (squeezeFrame.js) , , .

;

  • clientWidth ( -Height), " "
  • scrollWidth (- -Height), (iframed)
  • zoom ( -moz-transform: scale for firefox) /

squeezeFrame.js

0

Source: https://habr.com/ru/post/1738841/


All Articles