make iframe height dynamic based on content inside- JQUERY/Javascript

前端 未结 20 1999
情书的邮戳
情书的邮戳 2020-11-22 07:42

I am loading an aspx web page in an iframe. The content in the Iframe can be of more height than the iframe\'s height. The iframe should not have scroll bars.

I have

20条回答
  •  无人及你
    2020-11-22 07:51

    You can retrieve the height of the IFRAME's content by using: contentWindow.document.body.scrollHeight

    After the IFRAME is loaded, you can then change the height by doing the following:

       
    

    Then, on the IFRAME tag, you hook up the handler like this: