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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:59:00+00:00 2026-06-03T09:59:00+00:00

I created an iframe with regular javascript. In that iframe is the Jquery function

  • 0

I created an iframe with regular javascript. In that iframe is the Jquery function along with JQuery. The code works in the iframe as one would expect. I want to have the parent page do the function and not within the iframe. The iFrame and all content is loaded from the same domain, although the code that creates the iframe can be ran on any site. For example, if siteB, siteA ran the code, siteA & B can create the iframe to siteZ’s website content.

Here’s the code so far from the iframe that I want to run in the parent page:

<script>
$(document).ready(function(){                       
    $().intad({
        title: "blahblah",
        url: "http://www.blah.com",
        timeout: 30,
        deplay: 2,
        wait: 3,
        closeable: true
    });
});
</script>

I tried this from the iframe:

<script>
$(document).ready(function(){                       
    function intad(){
        title: "blahblah",
        url: "http://www.blah.com",
        timeout: 30,
        deplay: 2,
        wait: 3,
        closeable: true
    });
});
</script>

And this from the code that is loaded into the parent page:

<script>
parent.document.getElementById("RandomIdHere").contentWindow.intads();
</script>
  • 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-03T09:59:08+00:00Added an answer on June 3, 2026 at 9:59 am

    In the iFrame, you need to put the function you wish to call on the window object so it is globally accessible.

    Once it is there, from your main, top level html page, you can do iFrameDomElement.contentWindow.yourFunctionToCall().

    EDIT:

    So, to break it down further, you have many issues happening with your code. First off, what is intad? Is it a method on the jquery prototype? If not, you are doing something wrong. Here is fundamentally what you need to do.

    in your main page, that i will call parent.html from now on.

    You need something like this:

    // this is a shorthand document ready function
    $(function() {
    
        // we will call this from the iframe
        window.functionInParent = function() {
            // do your work here
        };
    
        var iframe = document.createElement('iframe');
        iframe.src = 'link/to/iframe/source';
    
        // if you want to talk to the iframe from this parent page,
        // use this to access the iframe's window object.
        // just make sure that the function you try to call is on the
        // window object of the iframe, just like we did with the function above.
        var iframeWindow = iframe.contentWindow;
    });
    

    In your iframe, you need something like this:

    $(function() {
        // your iframe's dom is ready - do stuff here
    
        // once you are ready, call the parent function
        top.functionInParent();
    });
    

    I hope this helps. If you need further help, put your working (or almost working) code into a jsfiddle so i can look at it in a better way.

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

Sidebar

Related Questions

I have created an iframe code that I want people to use as a
I have a dynamically created iframe made with regular javascript. It works great when
I have some JavaScript code that dynamically injects an iframe in a given HTML
I created an iframe using jQuery that I want to insert into an existing
If I write some JavaScript that runs in an <iframe> (which is dynamically created
I'm trying to create a widget (which is basically an iframe) that would have
I have created an iframe facebook application. I want to use the facebook's comments
I have a dynamic webpage that includes an iFrame where external html code is
Hi i have created new iFrame APP. this is code part: <fb:visible-to-connection>Welcome, fans!<fb:else>Become fan</fb:else></fb:visible-to-connection>
I have created a web user control I want to change the iframe' src

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.