davidjbradshaw / iframe-resizer

Keep iFrames sized to their content.

Home Page:https://iframe-resizer.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Library removes height:auto inline style from html and body elements

DanielStout5 opened this issue · comments

Describe the bug
The site being embedded in the iframe has a height:100% CSS rule applied to HTML and Body. We are overriding it via an inline style, but that's getting removed by this function:

function stopInfiniteResizingOfIFrame() {
    document.documentElement.style.height = ''
    document.body.style.height = ''
    log('HTML & body height set to "auto"')
  }

To Reproduce

  1. Create a page with
  2. Embed it in an iframe and add the iframe-resizer library
  3. Observe that height:auto gets removed

Expected behavior
The inline style should not be removed if its value is auto

Yeah if you set those properties it can cause havoc with keeping tabs on the size of the content in the iFrame. This code is their to protect you from that.