File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

check if a window with a particular name is already opened

 
Mahesh Shiwani
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

i want to check whether a popup (or any other window) with a particular name say 'x' is already opened or not. And twist in story is that i am opening child window from two(or more) different parent screens, and all the time child window name is same. so i want to check whether child is already opened, no matter from any parent screen.

Thanks & Regards,
Mahesh Shiwani.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


You may find issues when changing pages since you loose objects.

Eric
 
Mahesh Shiwani
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are absolutly right Eric, when i change pages i loose the object and that is the problem. is there any way that i can check in windows registry for some other place say "whether any window in this system (PC) with name 'X' is already opened or not".... looks simple question but till now no answers.. :-))
Thanks & Regards,
Mahesh......
 
Premil Jacob
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u could write a value to a cookie when the window is opened and removing the value when the window is closed.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only real way to do it is to use a hidden frame, but that can kill the site.

You could use and onunload handler and close the window when the page changes.

Eric
 
Rob Hunter
Ranch Hand
Posts: 832
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for this posting. I had posted a similar question before and people have said check the object, check the object. This doesn't work when (as stated) you change pages or resubmit the form you're on. Thanks Eric for the helpful advice.

Rob
 
Rob Hunter
Ranch Hand
Posts: 832
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition to this, if I'm using a pop-window and I write to it using a javascript function how can I clear the window when writing to it the second, third, fourth, etc.., time? Thanks for the help.

Rob
 
Farouk Sherefudheen
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code u provided calls window.open first and then does the check.
So every time this will open the window whether there is a window present or not already.

Please reply
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Farouk Sherefudheen:
This code u provided calls window.open first and then does the check.
So every time this will open the window whether there is a window present or not already.

Please reply


That is just lines of an example, it was not a working code.....
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Pike:
In addition to this, if I'm using a pop-window and I write to it using a javascript function how can I clear the window when writing to it the second, third, fourth, etc.., time? Thanks for the help.

Rob


All I would do is:


That replaces the content and the back button will still access the content in the window. If you do not want that then you would want to use document.body.innerHTML = "your content"

Eric
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic