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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:56:04+00:00 2026-05-31T19:56:04+00:00

I have nested iframes and I would like to use onload function for the

  • 0

I have nested iframes and I would like to use onload function for the inside frame. For example:

<script type="text/javascript">
 var testing = 'test';
 var curFrames;
 var curUrl;
 var mFrames;
 var cFrame;
 var editor;
 var editor2;

 window.onload=CodeOnLoad;

 //Javascript that runs on load
 function CodeOnLoad() {
  curFrames=document.getElementsByTagName("frame");

  console.log(curFrames[0])

  //onload for 1st frame  
  curFrames[0].onload = getInside;


  function getInside() {
   //onload for second frame - Not working 
   curFrames[0].contentDocument.getElementByid('the_iframe').onload = finalFrame;
  }

  function finalFrame() {

   curUrl= curFrames[0].contentDocument.getElementById("the_iframe").src;
   console.log(curUrl);

   if (curUrl.indexOf("post")!=-1)
   {
    mFrames=document.getElementsByTagName("frame");
    cFrame = mFrames[0].contentDocument.getElementById('the_iframe');
    editor = cFrame.contentWindow.tinymce.activeEditor;
    console.log(editor);    
   }
  }
 }

 </script>

The code (second callback):

curFrames[0].contentDocument.getElementByid('the_iframe').onload = finalFrame;

is never executed.

Is it possible to do it like that?

I want to ensure that all frames are loaded before executing any code.

Thanks

  • 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-31T19:56:05+00:00Added an answer on May 31, 2026 at 7:56 pm

    Consider below as your window tree

    Parent Window (P1)

    —-Iframe 1 (I1)

    ——–Iframe 2 (I2)

    Now in p1, keep function say pfunc, in which you code whatever you want to code

    in I1 keep a function as below

       function callParent()
       {
           parent.pfunc();
       }
    

    in I2 on window onload call below function

    function callParent()
    {
       parent.callParent();
    }
    

    this will do as you want.

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

Sidebar

Related Questions

I have nested grids in my views and would like to use same CSS
I have two nested loop in XSL like this, at this moment I use
I have nested lists that represents a table of sorts. I would like to
I have a nested list like this: <ul class=list> <li class=list_item_type_1> <ul class=list> <li
I have a frame that's nested in an iFrame. <iframe>..<frameset..><frame id=report> . I have
We have nested folders with parent-child relationship. We use MySQL MyISAM DB. The data
I have nested repeaters and checkbox in each row(like a tree view or ctaegory
I want to have nested views in a single view like a JTabbedPane. Is
Is there anyway to have nested jQuery selectors. For example: if the page also
If I have nested pages, is it possible for, for example, the top level

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.