changing Iframe's height from itself ..

P

Prasad

Hi ,
I am using a cross domain iframe in my page..
If i want to change the iframe height a/c to its content height , its
giving Permission denied error as i am trying to access a function,
which changes an iframe's height, in the parent window ...


So Is there any way to change its height from the iframe
itself???????


Plz help me out in this case ..........


Thanx in advance..................
 
M

Martin Honnen

Prasad said:
So Is there any way to change its height from the iframe
itself???????

As said (in de.comp.lang.javascript), for IE/Win you can use
window.resizeTo(someWidth, someHeight)
even on iframe window objects and it will resize the iframe. As for
getting the document height, look into the function you already have, it
is simply a question of accessing the right document properties e.g.
window.resizeTo(document.documentElement.offsetWidth,
document.documentElement.scrollHeight);
where the only problem is that depending on the IE version and the
rendering mode you need to access document.documentElement or document.body.
 
P

Prasad

Martin said:
As said (in de.comp.lang.javascript), for IE/Win you can use
window.resizeTo(someWidth, someHeight)
even on iframe window objects and it will resize the iframe. As for
getting the document height, look into the function you already have, it
is simply a question of accessing the right document properties e.g.
window.resizeTo(document.documentElement.offsetWidth,
document.documentElement.scrollHeight);

I am using a function ...........

function changeHeight()
{
//
window.resizeTodocument.documentElement.offsetWidth,document.documentElement.scrollHeight);

// window.resizeTo(200,400);


window.resizeTo(document.documentElement.offsetWidth,document.body.scrollHeight);


setTimeout("changeHeight()",1000);
}


its first time called when iframe body is loaded ..
But its behaving very wierd .. the height of the iframe is increasing
and decreasing to some arbitrary value and after some time, an error
that "Access is denied " is being displayed ...

this iframe's domain is different from the parent's domain .....(but i
dont guess its a problem ..)

And i tested this function with a sample iframe in the same domain ..
its working fine... ( )


what could be the problem in the first case ??
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top