Forum Moderators: open
thanks
Salva
Yes, it can be done with javascript. Here are a couple of resources:
[developer.irt.org...]
[webreference.com...]
smgagaz, thanks for the idea that the new window could close automatically. It's such a direct solution that I smack myself in the head for not coming up with it. The code for automatically closing the new window could go in the BODY tag for the top window's document, like this:
<body onBlur="self.close()">
I've been using
<body onBlur="self.focus()">
That gets tricky on some browsers (like Netscape) which still allow temporary focus for another page. There's also the chance of an infinite loop, if the code ends up on a machine where another open window also has similar code. This is a much more graceful solution.
This means that any links on the pop-up page are essentially non-functional. With onBlur=self.focus(), the links will load, but stay behind the open pop-up to be viewed when that pop-up is closed by hand.
IT seems that the click can be anywhere on the page, even on the background, and the focus leaves the window -- which closes it. Interesting situation. Even a right click has the effect of closing the window, but only after the menu choice you make is executed (i.e. view source).