homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

change IFRAME height from javascript inside the iframe

 7:27 pm on Nov 15, 2007 (gmt 0)

I want to have a "minimised" view of an iframe - user clicks a button to reduce the height. the problem I"m running into is that I need to be able to click a link inside of the iframe to do this. It looks similar to the standard _ minimise button in all browsers.
Is there a way to modify the properties of the iframe from INSIDE of the iframe itself? I have done a lot of searching for this, but can't seem to get it right.



 7:45 pm on Nov 15, 2007 (gmt 0)

You may have to activate a script on the parent page(the one where the iframe code is).

search for "javascript cross frame scripting" it should be a good start.


 2:34 pm on Nov 16, 2007 (gmt 0)

It's possible as long as both the parent and iframe pages are on the same domain!


 5:45 pm on Nov 16, 2007 (gmt 0)

sorry to take so long to reply.
@Dabrowski - can you elaborate? I am familiar with accessing the main page via "window" and can change the size of the main window via window.top from inside the iframe. My testing with "self" didn't get me there, though.

Is this something you'd use the document object for or window?

these are indeed on the same domain.


 6:03 pm on Nov 16, 2007 (gmt 0)

To change the size of the iframe, you'd need to do it from the parent window.

The reason I asked if they were on the same domain is that if they weren't, there would be absolutely no way to 'talk' between them.

You should be able to access that from inside your iframe with:
parent.document.getElementById( "youriframe");


 6:14 pm on Nov 16, 2007 (gmt 0)

thanks a lot!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved