Results 1 to 6 of 6

Thread: Auto-resizing IFrame?

  1. #1
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Unhappy Auto-resizing IFrame?

    I tried a script on this site, but it didn't work

    I want the IFrame to automatically change height depending on what is inside it. I tried 2 different ones on this, one didn't work, and the other was not able to resize for pages that are not on the same domain.

    Does anyone have a working script that will work for me?

    Thanks.

  2. #2
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Which scripts did you try, ie their URLs? Also, what browser are you using? The scripts to re-size the iframes can be buggy depending on the browser.

    Also - no re-sizing script will work if the page containing the iframe has a different domain from the iframe. Due to cross-browser security issues, things like links will work, but javascript that involves accessing data (such as page height) will not.

    But send the URL's of the scripts you tried - there may be an updated one that will work better, so long as your pages are on the same domain.
    Last edited by jscheuer1; 04-16-2007 at 03:25 PM. Reason: spelling

  3. #3
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I can edit the html on the page inside my IFrame, but it is not on the same server, or domain. Is there any javascript I can add to the page inside the frame that sends to the page holding the frame to calculate the size or something?

  4. #4
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Not that I'm aware of. I had a similar situation, but kept running into the cross-domain and cross-serve issue.

  5. #5
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Just create the layout inside the page that the iframe points to, to have 100% height (without padding/margins, that will cause it to overlap).
    - Mike

  6. #6
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    100&#37; height layout - tried that with <body onload="resizeTo(document.body.scrollWidth,document.body.scrollHeight)" style="height:100%">
    It made the page full-length when it was openned by itself in IE (tho not in FF), but then didn't work when the frame was loaded into the iframe. Which was the whole point.

    Also tried cookies. Ditto. Concluded it's not possible to run the DD re-size script across different domains. Anyone have an example otherwise?
    Last edited by Veronica; 04-22-2007 at 12:41 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •