Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3600664
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:31:27+00:00 2026-05-18T20:31:27+00:00

We have an embeddable badge that creates an iframe. It needs to be a

  • 0

We have an embeddable badge that creates an iframe. It needs to be a dynamic size; it changes size based on data loaded from a 3rd party API or our database. So it’s not known what height it will be before it loads.

It’s invoked with a tag that loads a script from our server, which creates an iframe set to a specific src.

On my own machine, within the iframe I can do

window.parent.document.getElementById('my_frame').style.height=new_calculated_height+'px';

but of course when it’s embedded in a page different than the iframe src, that fails due to crossdomain restrictions (‘unsafe access attempt’ error in FF, etc.).

As we’re already loading a script into the host page with full access, this is kind of silly.

Basically, I need to get a variable, the new height, from the iframe into the host page.

Could I do it in reverse maybe? Have a function on the host page ask the iframe for it’s an element’s offsetHeight?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:31:27+00:00Added an answer on May 18, 2026 at 8:31 pm

    This can be a real pain in the butt to get working cross browser.

    I strongly suggest you use easyXDM (http://easyxdm.net/). It’s a JavaScript library that uses the PostMessage transport on modern browsers and uses some JavaScript ninja on old browsers.

    The library allows you to communicate between an Iframe and it’s parent even if they aren’t on the same domain.

    The library supports all the way down to IE6!

    Edit: There’s actually an example to resize the height of an Iframe dynamically once content is loaded: http://easyxdm.net/wp/2010/03/17/resize-iframe-based-on-content/

    • Christian
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple page that contains an iframe. The iframe contains a page
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the
Almost every new website seems to have an intro video that tells prospective new
There seems to be multiple extremes when supporting embeddable Java HTTP servers. I have
I have an object with a field that can be a number of object
Writing a embeddable cross-browser plugin that is scriptable via JavaScript i am unsure how
I have one table with composite key attribute.. For that i have made 2
Is there any open-source document-oriented key-value map/reduce storage that: is easily embeddable (Yes, it
Have noticed issue while testing iphone app that if one quickly opens/dismisses a modal
Have just started using Google Chrome , and noticed in parts of our site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.