开发者

IFrame Resize Solution - A Cross-Browser Compatible Solution

开发者 https://www.devze.com 2023-02-02 05:44 出处:网络
New Year Greetings Y\'all.... I know there are some references to this issue here on stackoverflow, but I found none of them quite useful. I\'ve an Iframe whose src attribute is dynamically set throu

New Year Greetings Y'all....

I know there are some references to this issue here on stackoverflow, but I found none of them quite useful. I've an Iframe whose src attribute is dynamically set through PHP. I would like it to resize itself according to it's content ( JavaScript) . Any insights?

(So开发者_高级运维lutions mentioned on this site for the same problem faced do not work for me)

Thank You, Abhijit


Best solution: Don't use an IFrame, but embed the content inside a div. That will give you much more control. An IFrame is more or less a black box. I don't think the document outside the box can not what is in the box (for security reasons), so it cannot perform calculations either. The document inside the box doesn't even know that it's inside an IFrame.

The best option would be to let the PHP document determine which page is shown, but do that a little earlier, so you can use that fact to render a slight difference in the parent document as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消