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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:26:22+00:00 2026-05-28T13:26:22+00:00

In my site, I use an iframeA in an iframeB, and, when the iframeA

  • 0

In my site, I use an iframeA in an iframeB, and, when the iframeA changes it’s content I have to set the src. I can set it only with the onload event, but this called when the site is loaded. I am looking for some event or trigger, that helps me detect the location/src change before it starts loading. I don’t want to wait the whole page load, before the src set. I have no direct access to iframeA (just the script below)

Some code:

var myframe = document.getElementById('frameB').contentWindow.document.getElementById('frameA');
myframe.onload=function (funcname) {...};
  • 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-28T13:26:23+00:00Added an answer on May 28, 2026 at 1:26 pm

    What will be changing the source of the iframe? If you have access to that code then you can do whatever is in your onload function then.

    If a link has it’s target attribute set to the iframe and that is how the source is changing then you can hi-jack the link clicks:

    $('a[target="frameB"]').bind('click', function () {
        //run your onload code here, it will run as the iframe is downloading the new content
    });
    

    Also, just a side-note, you can bind an event handler for the load event in jQuery like this:

    $('#frameB').bind('load', function () {
        //run onload code here
    });
    

    UPDATE

    SITE -> frameB -> frameA

    $("#frameB").contents().find("#frameA").bind('load', function () {
        //load code here
    });
    

    This selects the #frameB element (that is in the current top level DOM), gets it’s contents, finds the #frameA element, and then binds an event handler for the load event.

    Note that this code must be run after #frameB is loaded with the #frameA element already present in it’s DOM. Something like this might be a good idea:

    $('#frameB').bind('load', function () {
        $(this).contents().find('#frameA').bind('load', function () {
            //run load code here
        });
    });
    

    UPDATE

    To hi-jack links in the #frameB element:

    $('#frameB').contents().find('a[target="frameA"]').bind('click', function () {
        /*run your code here*/
    });
    

    This will find any link in the #frameB element that has its target attribute set to frameA and add a click event handler.

    And again, this will only work if the #frameB iframe element has loaded (or atleast gotten to the document.ready event) so you can select it’s elements.

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

Sidebar

Related Questions

I use a site that looks like this: ... <body> <iframe src=blabla/blabla...></iframe> </body> ...
I use an iframe in my site , How i can let the search
The Django admin site makes use of a really cool widget: How can I
In general, If I have a choice when developing a web site to use
I have a c# site which makes use of a lot of images with
I have a site that makes use of GET variables to determine what to
I have one site that is displaying html content that needs to be displayed
I am trying to use this like box on a site and getting duplicate
I have a asp.net website in the umbraco cms, there I can use razor
So I have this code: <iframe id=theFrame src=http://localhost style=width:100%; frameborder=0> </iframe> and the localhost

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.