Title: RE: [OT] Re: How to create a browser popup window
Hello,
Thanks for all the window tips.
I have fixed it with out using any javascript.
just mention in your html head
and give TARGET=_self to the references which should be opened within the
parent window.
Thanks,
Domien
-Original Message-
From: Rob Bloodgood [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 20, 2001 9:26 PM
To: Nick Tonkin
Cc: mod_perl
Subject: RE: [OT] Re: How to create a browser popup window
> You must include code to deal with the fact that you may have already
> opened a popup window. Something like this:
That is simply not true. window.open() with a named window ('popupwin', in
your example) ALWAYS reuses that window, on every browser I've ever been
able to test. The second call to window.open, with a new URL, simply
refreshes the contents of the popup w/ the new URL. Note, this is *only*
true for named windows. Windows without a window name string as the second
parameter to window.open() will open a new window every time.
It can, however, be a good idea to explicitly call focus() on your child
window, because in the situation I've just mentioned, if the child window's
url is refreshed, it is NOT automatically brought to the foreground.
The original post was wondering how to put mod_perl output in a popup
window. The answer is simply top call window.open() with the URL of the
mod_perl handler as its location.
If one is trying to be "responsible" about the window(s) being open, adding
a link like
CLICK" HERE CLOSE THIS WINDOW
in the child window is usually reasonably simple for the user to understand.
Of course, the normal caveats about users understanding something still
apply...
A corrected version of your sample script follows. It's much simpler now...
:-)
> </FONT>
<BR><FONT SIZE=2>> <!-- Hide</FONT>
<BR><FONT SIZE=2>> var popupwin = null;</FONT>
<BR><FONT SIZE=2>> function popup(loc,ww,hh) {</FONT>
<BR><FONT SIZE=2>> var mywidth = (ww + 10);</FONT>
<BR><FONT SIZE=2>> var myheight = (hh + 10);</FONT>
<BR><FONT SIZE=2>> var myspecs =</FONT>
<BR><FONT SIZE=2>> "'menubar=1,status=1,resizable=1,location=1,titlebar=1,toolbar=1,</FONT>
<BR><FONT SIZE=2>> scrollbars=1,width=" + mywidth + ",height=" + myheight + "'";</FONT>
<BR><FONT SIZE=2>></FONT>
<BR><FONT SIZE=2>> popupwin = window.open (loc, 'popupwin', myspecs);</FONT>
<BR><FONT SIZE=2>> popupwin.focus();</FONT>
<BR><FONT SIZE=2>> }</FONT>
<BR><FONT SIZE=2>>
> Look at foo
L8r,
Rob
#!/usr/bin/perl -w
use Disclaimer qw/:standard/;