I have the following scenario:
- A user on one our customer s website clicks a link. It performs an automatic signon with their credentials to our site, which is launched in a new window.
- User on our site logs out, and is sent to a page which does a JavaScript
window.close()
, which closes the window. If they were a customer that logged into our site directly then they would go back to the Login page, but being automatically signed on, they have no use for the Login page, so the page automatically closing is better.
However sometimes the following happens
- A user on one our customer s website clicks a link, performs an automatic signon with their credentials to our site, which launches in a new window.
- While in our application they click on the "Help" link, which at this time is another popup window.
- At some point they log out of our app, which closes that window.
- The help window is still open.
- The user clicks on a link in the help window.
- The user, not being logged in anymore, now goes to a login screen in that help window.
- MASS HYSTERIA!
So what I d like to do is ensure that when that original window is closed, it also closes any popup windows it spawns. I figure this can be done in JavaScript but how?
ADDENDUM: The suggestions below are nice but the problem is the page the user is on when the browser closes is not the same page that spawns the popup, so the handles to the pages are all gone. How can I get the handle to a popup window with a specific name?