js stay on top/print catch 22

by Dave Alders <yldman(at)sierra.net>

 Date:  Wed, 01 Nov 2000 12:34:49 -0800
 To:  hwg-techniques(at)hwg.org
  todo: View Thread, Original
Hi,

I have a problem where I have some small popup windows
that use minimum chrome - no nav, location, menu, etc.
The client wants visitors to be able to print these pages (!),
so I added a javascript window.print to them.  There are
six links to individual popups on the opening page, so it is
sometimes a problem where the visitor clicks a link to
another popup before closing the one he's got open.  Then,
since he clicked back on the main page, it gets focus and
the popup gets buried behind and he thinks the new popup
didn't load -- which it did, it's just behind the main window.
OK, so I add a javascript function called by the onblur event
in the body tag of the popup to test if the browser can handle
a window.focus (since AOL can't) and if so, give the popup
window the focus. OK, peachy.  Now the popup can't get
buried -- every time it loses focus, the onblur event fires and
forces it to regain the focus. New popups open fine, etc.
Even AOL'ers don't get an ugly error message.
I personally feel that "forced window management" is kinda rude
(I'm sure there's some hot opinions on the usability issues of
this -- please strive for civility :)   ) but it's also tradeoff one
may have to accept when using popups (which I'm beginning
to dislike more and more).

Here's where the trouble begins.

So now the visitor clicks the "print" link in the popup window.
The MSWindows printer dialog box opens, BUT it can't get the
focus (!!!) and hence can't receive the click to the "OK" button!
(In fact, it you can't click the "Cancel" button either -- the only
way to dismiss the print dialog is to close the popup window
first...)

So...how do I...keep popups from getting buried while allowing
a printer dialog box to accept focus long enough to click the "OK"
(or "Cancel") button?  Pointers to resources, examples, etc.
also appreciated...

TIA,

Dave Alders
yldman(at)sierra.net

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA