Are both the iframe content and the outer page that contains the iframe served from the exact same server? (Everything – hostname, protocol, port EXACTLY the same?) If so, you can force an iframe to take on the size of its content page using some JavaScript. But if any part of this is different, the Same Origin Policy will fail, and a script from one host cannot affect content from another.
It’s best if the iframe URL does not have any hostname information in it, as though the code was like this:
<iframe src="/path/to/page.html"></iframe>
rather than
<iframe src="http://example.com/path/to/page.html"></iframe>
If the first example looks like your code, then the iframe’s origin will always match that of the outer page, and you can use this trick.
In the Page / HTML Markup / Before section, paste the following code:
<script type="text/javascript">
(function(){
var iframe = document.querySelector('iframe');
iframe.addEventListener('load', function(){
var new_height = iframe.contentWindow.document.body.offsetHeight;
iframe.style.height = new_height + 'px';
});
})();
</script>
This script requires that there only be one iframe on the page in order to work. If you have applied Twitter or Facebook Actions to your page, that may no longer be true. Let me know if this works for you, and if you need to adjust it to work around the multiple iframe problem, there is a way to do that.
Walter
On Nov 22, 2014, at 11:12 AM, rakeljuice email@hidden wrote:
Hello. Ive got an iFrame at a page that shows several pages content, if you pressone or the other button. These pages are web yep editable, and the content of the first one is too short and the content of the second one is too long, so I would like to make the iframe get the size of the content by itself, without scroling. Is it possible?
Thanks.
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options