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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:12:44+00:00 2026-05-27T06:12:44+00:00

I have an iframe that loads a page inside it.. when a link is

  • 0

I have an iframe that loads a page inside it.. when a link is clicked on the page in the iframe, resize the body of the parent aka the document that has the iframe’s body..

 Body         <------------------------
    Iframe                            |
        Page                          |
         Link... Upon Click, resize body --

How do I do the above? I tried Parent.document.body.style.width = “200px”. and it didn’t work. Not sure what to do. Please Help!

function Parentresize(id)
{
var newheight = 2000;
var newwidth = 2000;
parent.document.getElementById(id).height= (newheight) + "px";
parent.document.getElementById(id).width= (newwidth) + "px";
}
  • 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-27T06:12:45+00:00Added an answer on May 27, 2026 at 6:12 am

    Ok I figured it out. This code will exactly do that. It is a bit lengthy because of extra code for cross browser compatibility:

    function WindowSize()
    {
        WinWidth = 0, WinHeight = 0;    //Initialize variables with a value of 0;
        if(typeof(parent.window.innerWidth) == 'number')    //Well I need the parent width of the iFrame aka browser width. Width is a number, not undefined..
        {
                //FireFox/Opera..
            WinWidth = parent.window.innerWidth;
            WinHeight = parent.window.innerHeight;
        }
        else if(parent.document.documentElement && (parent.document.documentElement.clientWidth || parent.document.documentElement.clientHeight))
        {
            //IE 6+
            WinWidth = parent.document.documentElement.clientWidth;
            WinHeight = parent.document.documentElement.clientHeight;
        }
        return WinWidth;
    }
    
    function BodyResize(ID)
    {
        var IDTag = parent.document.getElementById(ID);
    
        if(IDTag.clientWidth == '1024')
            IDTag.style.width = (WindowSize() + 'px');
        else
            IDTag.style.width = '1024px';
    }
    

    just call this function BodyResize(ID)
    as

    <body id="mainbody" onClick="BodyResize('mainbody')">
    or
    <iframe id="interframe" onClick="BodyResize('interframe')">

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

Sidebar

Related Questions

I have a page in html (parent page) that have inside an iframe. When
I have an IFrame inside my 1st page that loads another page which I
I have a page which has an Iframe. In that Iframe, there are six
I have a page that has an iframe From one of the pages within
I have an iframe on a page and there's a link inside the iframe.
I have a jQuery modal dialog that loads a different page on an iframe.
I have a very long iframe inside my parent page. When you reload or
I have a portal application that loads external content (widgets) via an iframe. Users
I have a script that dynamically loads iframes inside a webpage. You can see
I have an iframe that returns data to the top.document window just fine by

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.