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 3237746
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:46:27+00:00 2026-05-17T17:46:27+00:00

I have a Help page, help.php that I am loading inside an iframe in

  • 0

I have a Help page, help.php that I am loading inside an iframe in main.php
How can I get the height of this page once it has loaded in the iframe?

I am asking this because I can’t style the height of to iframe to 100% or auto. That’s why I think I need to use javascript..
I am using jQuery

CSS:

body {
    margin: 0;
    padding: 0;
}
.container {
    width: 900px;
    height: 100%;
    margin: 0 auto;
    background: silver;
}
.help-div {
    display: none;
    width: 850px;
    height: 100%;
    position: absolute;
    top: 100px;
    background: orange;
}
#help-frame {
    width: 100%;
    height: auto;
    margin:0;
    padding:0;
}

JS:

$(document).ready(function () {
    $("a.open-help").click(function () {
        $(".help-div").show();
        return false;
    })
})

HTML:

<div class='container'>
    <!-- -->
    <div class='help-div'>
        <p>This is a div with an iframe loading the help page</p>
        <iframe id="help-frame" src="../help.php" width="100%" height="100%" frameborder="1"></iframe>
    </div>  <a class="open-help" href="#">open Help in iFrame</a>

    <p>hello world</p>
    <p>hello world</p>
    <p>hello world</p>
    <p>hello world</p>
    <p>hello world</p>
</div>
  • 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-17T17:46:28+00:00Added an answer on May 17, 2026 at 5:46 pm

    ok I finally found a good solution:

    $('iframe').load(function() {
        this.style.height =
        this.contentWindow.document.body.offsetHeight + 'px';
    });
    

    Because some browsers (older Safari and Opera) report onload completed before CSS renders you need to set a micro Timeout and blank out and reassign the iframe’s src.

    $('iframe').load(function() {
        setTimeout(iResize, 50);
        // Safari and Opera need a kick-start.
        var iSource = document.getElementById('your-iframe-id').src;
        document.getElementById('your-iframe-id').src = '';
        document.getElementById('your-iframe-id').src = iSource;
    });
    function iResize() {
        document.getElementById('your-iframe-id').style.height = 
        document.getElementById('your-iframe-id').contentWindow.document.body.offsetHeight + 'px';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have page loading, via AJAX a PHP page into a div. In turn,
In my webapp I have a page called display.php. The script in this page
I'm seeking a javascript history framework to handle navigation inside a page when the
Using PHP, and MySql, I am trying to implement this rather snazzy in-place editor
First off, here is the situation. I'm using a guild hosting site that allows
Is there a way to show a progress bar in php? I like to
I'm trying to build a bookmarklet that does the following: 1.)loads an external js,
Below is the complete code of the jquery AJAX tab script I am working
I am trying to make my pagination script a bit more dynamic and am
I am testing the security of my website. I am using the following URL

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.