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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:33:45+00:00 2026-05-12T19:33:45+00:00

I have a prototype representing a particual IFrame. That prototype have a function called

  • 0

I have a prototype representing a particual IFrame. That prototype have a function called GoToUrl(…) that opens the given url within the IFrame.

My question is: How do I create an “InternalDOM” property and make this property refer to the “window” object (the root DOM object) of the IFrame inside? In such way that: If my IFrame exposes a page which has an object X in it’s “window” object I could do:

MyFrameObject.GoToUrl(pageXurl);
MyFrameObject.InternalDOM.X

Any help would be appreciated.

PS: I would accept answers not necessarily related to jQuery but I would prefer a jQuery solution.

  • 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-12T19:33:45+00:00Added an answer on May 12, 2026 at 7:33 pm

    To get the window object for a frame you can use the window.frames array:

    var iframewindow= frames['iframe_name'];
    

    This requires that you give the <iframe> an old-school name attribute instead-of-or-as-well-as the id. Alternatively if you know the order of iframes on the page you can index them numerically:

    var iframewindow= frames[0];
    

    It’s generally more flexible to get the iframe window from the iframe element in the DOM, but this requires some compatibility code to cope with IE:

    var iframe= document.getElementById('iframe_id');
    var iframewindow= iframe.contentWindow? iframe.contentWindow : iframe.contentDocument.defaultView;
    

    jQuery defines the contents() method to grab the document node, but it doesn’t give you a cross-browser way to go from the document to the window, so you’re still stuck with:

    var iframe= $('#iframe_id')[0];
    var iframewindow= iframe.contentWindow? iframe.contentWindow : iframe.contentDocument.defaultView;
    

    which isn’t really a big win.

    (Note: be very careful using jQuery for cross-frame-scripting. Each frame needs its own copy of jQuery and methods from one frame’s copy won’t necessarily work on nodes from the other. Cross-frame-scripting is a topic fraught with traps.)

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

Sidebar

Related Questions

I have a custom control that has the following prototype. Type.registerNamespace('Demo'); Demo.CustomTextBox = function(element)
I have seen a function whose prototype is: int myfunc(void** ppt) This function is
Say I have the following code: function One() {} One.prototype.x = undefined; function Two()
I have a snippet to create a 'Like' button for our news site: <iframe
I have built a prototype function for Arrays and it doesn't allow me to
I have a prototype website written in PHP. Lately i've rewritten code to separate
I have extensively used Prototype before and it helped us add considerable interactivity to
I have a C++ API prototype void Func(int& size); How can I translate it
I have written a site in Prototype but want to switch to jQuery. Any
I have a problem with scandir() : The manpage contains this as prototype: int

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.