Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Dynamic resizing of iframes based on content height (http://www.velocityreviews.com/forums/t917832-dynamic-resizing-of-iframes-based-on-content-height.html)

Peter 04-29-2005 12:16 PM

Dynamic resizing of iframes based on content height
 
Hi,

Does anyone know of how I could dynamically resize an iframe based on
the content's height (for IE) so that no scrollbar appears for the iframe?
The content will be from a different domain. I have searched on the web and
have seen solution like this

<script>
function resize() {
var oframe = document.getElementById("frameID");

//***
//var odoc = oframe.document; //(1)
var odoc = oframe.Document; //(2)

var obody = odoc.body;

oframe.height = obody.scrollHeight;
}
</script>

The html :
<iframe onload="resize()" src=http://different.comain.content border="0"
....... > </iframe>

I have seen 2 solutions on the web, the only difference being lines (1) and
(2) get substitued.
My browser is version IE 6.

It seems that the solution with line (2) works perfectly when the content is
from the same domain but gets a Permission Error if the domain is different.

When the content is from a different domain solution (1) does not give
Permission error, but instead the scrollHeight is significantly smaller
than the actual content. Even if the content is from the same domain it
still gives the wrong size.

So my question is
1) What is the difference between oframe.document and oframe.Document, why
does it give different results?

2) More importantly, how can I dynamically adjust the iframe size based on
the content height from a different domain?



Thomas 'PointedEars' Lahn 05-08-2005 10:31 PM

Re: Dynamic resizing of iframes based on content height
 
Peter wrote:

> Does anyone know of how I could dynamically resize an iframe based on
> the content's height (for IE) so that no scrollbar appears for the iframe?
> The content will be from a different domain. [...]


The Same Origin Policy prevents this almost certain violation of author's
rights. Your goal would be a contradiction to the purpose of an iframe
anyway.


PointedEars


All times are GMT. The time now is 06:13 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.