Adjust width and height of iframe to fit with content in it

前端 未结 30 2302
旧时难觅i
旧时难觅i 2020-11-22 02:09

I need a solution for auto-adjusting the width and height of an iframe to barely fit its content. The point is that t

30条回答
  •  隐瞒了意图╮
    2020-11-22 02:49

    It is possible to make a "ghost-like" IFrame that acts like it was not there.

    See http://codecopy.wordpress.com/2013/02/22/ghost-iframe-crossdomain-iframe-resize/

    Basically you use the event system parent.postMessage(..) described in https://developer.mozilla.org/en-US/docs/DOM/window.postMessage

    This works an all modern browsers!

提交回复
热议问题