Resize IFRAME

J

Jills

Hi All,

Does anyone have any idea about how can we resize an IFRAME
dynamically according to its content from another domain? I want to
increase the height according to the page that is displayed on it.

Regards,
Jills
 
H

Henry

Does anyone have any idea about how can we resize an IFRAME
dynamically according to its content from another domain? I
want to increase the height according to the page that is
displayed on it.

The document object representation of a page from a different domain
will be inaccessible and so it will not be possible to determine the
display dimensions of that document. Without that information it will
not be possible to alter the height of the IFRAME to match the height
of that document.
 
B

Bart Van der Donck

Henry said:
The document object representation of a page from a different domain
will be inaccessible and so it will not be possible to determine the
display dimensions of that document. Without that information it will
not be possible to alter the height of the IFRAME to match the height
of that document.

The original poster didn't mention how the iframe gets its new
content. When that instruction originates from the same domain as the
change of height, there is no problem:

<iframe id="ifr" height="100"></iframe>
<hr>
<input type="button" value="Google" onClick="
document.getElementById('ifr').src='http://www.google.com';
document.getElementById('ifr').height='200px';
">
<input type="button" value="Altavista" onClick="
document.getElementById('ifr').src='http://www.altavista.com';
document.getElementById('ifr').height='350px';
">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,263
Messages
2,571,064
Members
48,769
Latest member
Clifft

Latest Threads

Top