SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Feb 2009
    Location
    Austin Texas
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Dynamic iframe height with external domain src

    I am trying to get an iframe to have dynamic height - I want it to resize to fit the contents of the page.

    There is a four or five step process within the iframe. So for example, page 1 is rather short, and it'll have a link that sends you to page 2, which might be rather long.

    I have no control over the pages I am using in the iframe and they are on another domain.

    I have googled and and searched the forum and I've yet to find anything that works. A lot of them say they're not cross-browser compatible, but I haven't gotten anything to work how I'd like in any browser.

    I'd like to do it without jQuery. If it's just flat out impossible, please let me know.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    It's flat-out impossible. Move along
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Read up on the "Same origin policy"...

    There's no way to access the iframe's content if it's not on your domain.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  4. #4
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can have your script rewrite the IFRAME tag itself to make it fill the height of the window. That's all the user can see without scrolling anyway. Better than nothing.

  5. #5
    SitePoint Addict
    Join Date
    Feb 2009
    Location
    Austin Texas
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks everyone for the quick responses. We're going a different way, thankfully


Tags for this Thread

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
  •