Solved

Reference other window (not child)

Posted on 2011-09-07
10
176 Views
Last Modified: 2012-05-12
I have a window which is opened via window.open method from an iframe.

I need to be able to access the popup window from a document in a different iframe.

I have given the popup window the name HRA and tried to call hra.close from the other iframe but it is not working. How do I get a reference to the popup window from the iframe that did not spawn it?
0
Comment
Question by:sailing_12
  • 6
  • 4
10 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36497198
save the reference on the parent window.
ask the parent window to do the job (close window)
0
 

Author Comment

by:sailing_12
ID: 36497337
I don't actually want to close it, that is just a test to see if I'm referencing it successfully.

I actually want to call a function on the page.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36497410
save the reference on the parent window.
ask the parent window to do the job :)
0
 

Author Comment

by:sailing_12
ID: 36497564

Is this right?

<a id="aHRABalance" runat="server" onclick="var w = window.open(this.href, 'HRApopupwindow', 'width=1080,height=500,scrollbars,resizable'); return false;"></a>
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36497616
remove "var "
I suppose there's a href at the end.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:sailing_12
ID: 36497730
the href is being written programattically from .vb codde-behind (this is .net app).

This code successfully gets me the title of the page on which the function is written I want to fire. How do I call the function?
parent.frames['IFRAME_ResourceArea'].document.frames['ifrmBenefits'].document.title

Open in new window

0
 

Author Comment

by:sailing_12
ID: 36497822
Sorry, that last code succesfully gives me the title of the document which spawned the popup - the function I want to get at is in the head of the document loaded in the child popup.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 400 total points
ID: 36497911
try :
parent.frames['IFRAME_ResourceArea'].document.frames['ifrmBenefits'].the_function()


0
 

Author Comment

by:sailing_12
ID: 36498152
I got it. Included the reference to the child window (renamed hraPopupRef)
parent.frames['IFRAME_ResourceArea'].document.frames['ifrmBenefits'].hraPopupRef.UncheckHRAClaims()

Open in new window

0
 

Author Closing Comment

by:sailing_12
ID: 36498165
Thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now