This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Check if popup window is already open from parent window? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Check if popup window is already open from parent window? " Watch "Check if popup window is already open from parent window? " New topic
Author

Check if popup window is already open from parent window?

ekta patel
Greenhorn

Joined: May 16, 2011
Posts: 2
I am having a web page which contain four links, each link open a popup window. I am using a common JavaScript function to open popup window, as given below
function OpenPopup(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=Yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
targetWin.focus();
}

When I click on a link it will open a popup window, which contain a data entry form, I entered some information into that form. Then I need to review other information, from other popup window, so i go back to my main window, click on another link, a new popup window will get open which contain the information I need to review. I get the information and close this popup window, so now i am on my main window, then again I click on the link for that data entry form, so the popup window comes up but i lost the information that I have entered, it's because I am opening the popup window once again, and the new popup window will replace the existing popup with the same name.

Now my question is,
1 -Is their any way, I can check out the if popup window is already open from parent window?
2 - If the popup window is already open how can I just set the focus to it, rather then reloading it?
3 - How can I refer a child window from parent window, without having object of child window just by the name of child window?
4 - Can I refer a child window from a parent window, even after refreshing the parent window?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6


Refreshing the parent wipes away the reference to the child.


Eric
ekta patel
Greenhorn

Joined: May 16, 2011
Posts: 2
Yes I can access the popup window even after refreshing the parent window, you can see the solution to above problem on my blog
http://ektaraval.blogspot.com/2011/05/how-to-set-focus-to-child-window.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check if popup window is already open from parent window?
 
Similar Threads
child window closing
Unable to change the location of popup window in Netscape and Opera
Add and Edit a row
Problem in onfocus Javascript Function
Passing Value From Parent to Popup Window by Pressing the Enter Key