http://qs321.pair.com?node_id=24890

Mina has asked for the wisdom of the Perl Monks concerning the following question:

From the CGI.pm manual, one can get a new browser window to pop up if one uses:
$query = new CGI; [...] print $query->start_form(-target=>'_new'); [...]
My problem is that this opens a window of the same size as the original.

Now, is there a way to do this, by adding aditional arguments (that I don't know about) to the start_form, or, is there another way of doing this?

(In my time, all we had was HTML 2.0!)

~mina

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How can I open a new browser window to a given size?
by infinityandbeyond (Sexton) on Jul 30, 2000 at 02:32 UTC
    Unfortunately, even Perl can't conquer all your problems. The solution here is to use a Perl programmer's least favorite friend...Javascri pt. Quick and easy javascript solution:
    <script> window.open("script.pl","_new","width=1024,height=768"); </script>
    Buttons (and many other HTML tags) can have JavaScript attributes, where you can insert code, as well.

    Here are some useful URLs:

    Infinity ... and Beyond
Re: How can I open a new browser window to a given size?
by cwest (Friar) on Jul 28, 2000 at 21:39 UTC
    Not with that function, not with specifying targets.

    What you need to do is have <EVIL>JavaScript</EVIL> do the work for you and a plain form 'button'.

    "At least it's not ASP..."

    --
    Casey
    
Re: How can I open a new browser window to a given size?
by Anonymous Monk on Apr 10, 2004 at 03:57 UTC
    First, you should understand that you can't possibly do this in Perl, as Perl is not a client-browser-side language. So here is an off-topic Javascript technique.


    --------

    Assuming you are loading a document into the window:
    JavaScript *sigh* in an onLoad="blah()" function for the page to set the size...

    The method used to resize the Window in Internet Explorer is as such:

    <script>
    self.resizeTo(500,400);
    </script>

    For Netscape:
    <script>
    window.outerHeight = 500;
    window.outerWidth = 400;
    </script>

    Just some 2 cents. I'm cheap.

    ----Dave----

      I've used this general purpose javascript with Mozilla.
      print OUT<<End_Header; <html> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- function popitup(url,w,h) { newwindow=window.open(url,'name',"width="+w+",height="+h+""); newwindow.document.open(); newwindow.document.write('</body></html>'); newwindow.document.write('<html><title>'+url+' CLICK TO CLOSE</title>< +body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" o +nBlur="self.close()" onClick="self.close()">'); newwindow.document.write('<img src='+url+' height='+h+' width='+w+' a +lt=['+url+'] align=center >'); newwindow.document.write('<INPUT type="button" value="Close Window" on +CLick="window.close();">'); newwindow.document.write('</body></html>'); newwindow.document.close(); if (window.focus) {newwindow.focus()} return false; } // --> </SCRIPT> <body> <table align=left bgcolor=9999CC border=2 cellpadding=2 cellspacing=2> <tr> End_Header
      and to call it
      print OUT<<EOTR; <td align=center><a href="javascript:;" onClick="return popitup('$pic' +,'$w','$h')"><img alt= [$pic-thumbnail] src=$thumb height=$th width=$ +tw></a><br>$pic</td> EOTR

      I'm not really a human, but I play one on earth. flash japh
Re: How can I open a new browser window to a given size?
by icuc (Initiate) on Aug 02, 2000 at 11:33 UTC