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 <BASE TARGET=_blank> 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

<a href=""javascript:window.close()">CLICK" HERE CLOSE THIS WINDOW</a>

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...
:-)

>     <SCRIPT LANGUAGE="JavaScript">
>       <!-- Hide
>         var popupwin = null;
>         function popup(loc,ww,hh) {
>           var mywidth = (ww + 10);
>           var myheight = (hh + 10);
>           var myspecs =
> "'menubar=1,status=1,resizable=1,location=1,titlebar=1,toolbar=1,
> scrollbars=1,width=" + mywidth + ",height=" + myheight + "'";
>
>             popupwin = window.open (loc, 'popupwin', myspecs);
>                 popupwin.focus();
>         }
>     </SCRIPT>

>  <A HREF='javascript:' >Look at foo</A>


L8r,
Rob
#!/usr/bin/perl -w
use Disclaimer qw/:standard/;


Reply via email to