Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > changing Iframe's height from itself ..

Reply
Thread Tools

changing Iframe's height from itself ..

 
 
Prasad
Guest
Posts: n/a
 
      11-06-2006
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..................

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      11-06-2006
Prasad wrote:

> 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.offsetWid th,
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.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
Prasad
Guest
Posts: n/a
 
      11-07-2006

Martin Honnen wrote:
> Prasad wrote:
>
> > 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.offsetWid th,
> document.documentElement.scrollHeight);


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

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

// window.resizeTo(200,400);


window.resizeTo(document.documentElement.offsetWid th,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 ??





> where the only problem is that depending on the IE version and the
> rendering mode you need to access document.documentElement or document.body.
>
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
obtain element name, or attribute and value of the document name itself, and some elemnts and attributes from an ancestor or the node itself using xquery Jeff Kish XML 4 10-30-2008 05:47 PM
Why can't I change height with <col width="50" height="100">? Bernd Meier HTML 6 01-14-2008 07:25 AM
textbox height different than input height tshad ASP .Net 1 03-08-2007 10:04 PM
measuring web controls height at runtime (or converting .height % to px) Wotney ASP .Net 1 10-25-2006 01:39 PM
how to get specific cell height without hard-coding a height value laredotornado@zipmail.com HTML 0 08-19-2006 08:13 PM



Advertisments