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

  • SEARCH
  • Home
  • 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 7997773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:02:49+00:00 2026-06-04T15:02:49+00:00

I found and am using the following stackoverflow question and answer here . I’m

  • 0

I found and am using the following stackoverflow question and answer here. I’m using the iFrame inside of an iFrame that refers back to the parent domain in order to communicate my height back to it. I completely understand the concept and had this implemented fairly easily. The issue is that when I try to get the $(document).height() from jQuery as such or just by document.body.scrollHeight I’m seeing strange results in all browsers when my page is referenced inside of the iFrame.

Here is some background to what is happening on my page. I’m making some ajax calls to search a service of a third party provider and generating html inside of my page based on the results, pretty standard stuff. By the way, I am waiting for my html to be added to the DOM before grabbing the height of the document. Here are the results from $(document).height() when my page is inside of the iFrame.

FireFox 10.0.2 where the height picked up is almost 1000 pixels or more smaller than the actual height of the document.

Google Chrome 18.0.1025.162 will most of the time pick up the correct height. Sometimes the height is smaller by only a few hundred pixels.

Safari 5 behaves like FireFox does as well.

I’ve seen many blog posts with code showing the behavior. It doesn’t matter if I use jQuery or what is available to me with the javascript document object. I’m always seeing inconsistent results coming back from either one of those calls. I have to believe other people that have used this technique have ran in to this.

I don’t need to show my code for the iFrame resize or helper iFrame since these are functioning as expected. The main code I want to show is how I start the resize process from my search form after the ajax event and dom manipulation has finished:

function resizeMe() {
    var iFrameHelper = $("#iFrameHelper");
    iFrameHelper.attr("src", iFrameHelper.attr("data-url") + "?height=" + $(document).height() + "&cacheb=" + Math.random());
}
  • 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-06-04T15:02:50+00:00Added an answer on June 4, 2026 at 3:02 pm

    So I ended up figuring out what the issue was. The $(document).height() piece was working correctly. The issue is all about timing. The items that I render in the page after the ajax call has completed contain images that cause requests to go out from the page to get the images. There was no defaulted height set on the images therefore the height was not being calculated properly before I changed the src attribute on the iFrame inside of my page which kick starts the resize on the parent.

    What I ended up doing was just defaulting a height for all of my images since they share the same dimensions. I was blaming iFrames instead of myself. 2 days of pulling my hair out for such a simple reason.

    I hope this helps somebody else out in the future.

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

Sidebar

Related Questions

I found the following claim in the documentation for Net::OpenSSH : Note that using
I've recently found myself using the following macro with gcc 4.5 in C++11 mode:
I'm using the following example I found on the internet to dynamically build a
I found that using Smarty with PHP, sometimes extra time will need to be
-o changes the output filename (I found that using --help) But I can't find
I've found a similar question, but the accepted answer is not what I want:
I found this post about using GCC 4.2 in Xcode 4.2 StackOverflow Post .
Using the tiny Diggit/Blog feature of StackOverflow described here : I would like to
Following the apparent tradition of of using this question as the basis of new
I haven't been able to adapt the examples I have found in stackoverflow that

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.