GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Can I close windows opened with 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 "Can I close windows opened with "target=_blank"??" Watch "Can I close windows opened with "target=_blank"??" New topic
Author

Can I close windows opened with "target=_blank"??

Michael Greifenkamp
Greenhorn

Joined: Jul 02, 2001
Posts: 7
Hi there. I have a web menu system that allows users on a secure intranet to sign in and then access CGM graphics via links in a parent window. The CGMs are loaded into new windows using "target='_blank'" as part of their href.
The users can open multiple new windows this way.
Here's what I want to do: when the users finish their session, they click a log-off button that kills their session and returns them to the log-in page. I'd also like all those windows created with "target='_blank'" to go away.
I've hunted around the internet this morning but all solutions I find seem to involve opening the windows with javascript and giving them a unique name that is used to close them. With the number of cgms that user can open, that would be difficult to keep track of all those windows, I fear, using JavaScript?
Does anybody have a quick and dirty way to tell a browser (we are IE only, if that helps) to close ALL open windows, no matter where the came from, after a button is submitted (except for the main window, of course).
I know this is a bit much to ask, and I appreciate any thoughts that anybody has. Thanks in advance.
Mike
[This message has been edited by Michael Greifenkamp (edited December 06, 2001).]
Joel Cochran
Ranch Hand

Joined: Mar 23, 2001
Posts: 301
Michael,
I don't know if you are still looking for a solution, but you cannot control the windows opened with "_blank" from any other window.
If you need the ability to control these windows, have you considered using JavaScript to create the windows? Then you can close them from the parent window. You can also limit their functionality such as not including the Address line. This way, the user will not use that window to go to Yahoo or somewhere unrelated to your site (which can be importatnt to them when you start closing windows ).
Anyway, just some thoughts. Cheers!
------------------
I'm a soldier in the NetScape Wars...
Joel


Wait a minute, I'm trying to think of something clever to say...<p>Joel
Michael Greifenkamp
Greenhorn

Joined: Jul 02, 2001
Posts: 7
Joel,
Thanks for the reply. I've considered opening the windows using Javascript. This is for an intranet web system that will have a fixed anchor page with a bunch of menus, and clicking on an item in the menu would launch a new browser window with information inside.
My concern with using a javascript array for the windows is that if they open, say, newWindow[1], then newWindow[2], then newWindow[3], and somewhere in there, before logging out, they manually CLOSE newWindow[2] themselves, will a for loop that is going about closing the windows choke when it gets to "2"?
It looks like I've got some playing around to do, as there is, as I feared, no "easy" way to get rid of "target='_blank'" windows.
Thanks very much for the response.
Mike
 
GeeCON Prague 2014
 
subject: Can I close windows opened with "target=_blank"??