[英]iframe height adjustment
Is there a way to set the height of the iframe to be the same as the height of its source? 有没有办法将iframe的高度设置为与其源的高度相同?
I am trying to 我在尝试着
a) Avoid scrollbars and a)避免使用滚动条和
b) Avoid using fixed height in px b)避免在px中使用固定高度
Thank you. 谢谢。 :) :)
Since the source page is on a different domain — no. 由于源页面位于不同的域上 - 没有。
The only way to adjust its size based on the content is to measure the rendered size of the content using JavaScript, and the Same Origin Policy will prevent this. 根据内容调整大小的唯一方法是使用JavaScript测量内容的呈现大小,而同源策略将阻止这种情况。
if i understand correctly you have control over the iframe-content? 如果我理解正确,你可以控制iframe内容? in that case i wrote a javascript thingie (squeezeFrame.js) a couple of weeks ago, that can do just what you need. 在那种情况下,我几周前写了一个javascript thingie(squeezeFrame.js) ,它可以做你需要的。
essentially it uses; 基本上它使用;
you can see a couple of demo's of squeezeFrame.js in action here 你可以在这里看到几个关于squeezeFrame.js的演示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.