aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Is Child Window Open? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Is Child Window Open?" Watch "Is Child Window Open?" New topic
Author

Is Child Window Open?

Zath Misfit
Greenhorn

Joined: May 23, 2005
Posts: 5
I have been searching for a while now on how to do this, and most say it can't be done.... There is always a way around that statement.

Once a window is open, using


Another window may not be allowed opened until that one is closed.

I've been attempting to send a var back to the parent when the child is closed using the onunload method, but with no luck. If I could just do that, then it could solve the problem.

But if anyone else has another idea, it's welcome.

And btw, developing in .Net and have a temporary fix working using an application var, but that has a security hole in it.

Thanks all,

Zath
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi,

Welcome to JavaRanch!

Java and JavaScript are two utterly and completely different and unrelated languages. The similar names are the invention of a marketing team. Your question is about JavaScript. Most of this site is about Java, not JavaScript -- but we do have one forum entitled "HTML and JavaScript". I'll move your question there for you.


[Jess in Action][AskingGoodQuestions]
Zath Misfit
Greenhorn

Joined: May 23, 2005
Posts: 5
Thanks, my mistake. After posting I was reading other posts and realized it was java, something I did a while back.

And to add more to my post, here is what I have been attempting...
On the parent or opener page.....

And on the child page....


I just can't seem to get the var to post back to the opener and not open another window if it's already open.

Thanks......

Zath
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
As I said before whereever you posted this question before you do not need to set a variable since you can check the window object.

The following code checks to see if the window is open. If it is open, an alert message is displayed in the pop up. If it is not open, than a new window is opened up.



Eric
Zath Misfit
Greenhorn

Joined: May 23, 2005
Posts: 5
Yes, on the asp.net site, but still can't get it to work right.

One the child page that is opening, in the on_load event, I set window.opener.winPop = true;

It never seems to set the var.

Suggestions?

Thanks,
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
you do not need to set the varaiable winPop, the browser does it. The variable winPop holds a window object that holds the state of the browser window.

The thing is are you posting back the page to the server to open the new windows? If that is the case, then you are going to have issues since you loose the window object. There is no way to hold that.

Eric
Zath Misfit
Greenhorn

Joined: May 23, 2005
Posts: 5
Ok, finally got it working!!!

and of course, since I'm using .Net, in the code behind to call the function....


Thanks for the help,

Zath
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is Child Window Open?