Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Test if parent window exist

Posted on 2003-02-20
2
Medium Priority
?
289 Views
Last Modified: 2008-02-01
Hi,

I have the following frames

-------------------
|     title       |
-------------------
|    |            |
|menu|  content   |
|    |            |
-------------------

and a popup window

---------
| popup |
|       |
---------

I use a JSP errorpage from content frame and popup window and i need to reload the menu frame in both case.

I try this : parent.menu.location.reload() but this give me an error from the popup window.

Can you help me please ?

0
Comment
Question by:boxsters
2 Comments
 
LVL 1

Accepted Solution

by:
marc-pm earned 200 total points
ID: 7986547
Try this :
window.opener.parent.menu.location.reload()
or
window.opener.menu.location.reload()

(not sure if reference returned by window.opener is reference to the hole window or to the frame window that actually opened the pop-up window)

It ofcourse only works if you used window.open() method to show your pop-up window.
And check first if the element exists before you call its sub items/properties/methods to avoid errors :)
0
 

Author Comment

by:boxsters
ID: 7992137
Thanks a lot !

I try this code and it's what i need.

if (window.opener == null) {
     parent.menu.location.reload()
} else {
     window.opener.parent.menu.location.reload()
}
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

564 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