开发者

Auto-resize iframe based on content height

开发者 https://www.devze.com 2023-01-08 06:35 出处:网络
I have a site on my server that is pulling in an iframe from an external site in which I do not have access.

I have a site on my server that is pulling in an iframe from an external site in which I do not have access.

I want the iframe to resize the height based on the content that is being p开发者_JS百科ulled in so the page as a whole looks like a single page.

*I do not need to know how to get rid of the scroll bars.

Does anyone have any ideas? Thanks in advance!


I don't think it's possible. There is no way to interact with an iframe with JavaScript. That would have serious security consequences so browsers don't allow it.


What do you mean by 'the height of the content'? Is it an image, block of text, a table? You might be able to get round it using some kind of AJAX, but it will depend on the type of content in the iframe.


in css try

#frame_ID{
  height:auto;
}

I tried a whole bunch of things in css to see if there was any way to tell when the iframe didn't have a scrollbar and I found no solution so. Like the comment says this will not work.

0

精彩评论

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