Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to spawn a new browser window in Perl

Status
Not open for further replies.

BillyKrow

Programmer
Aug 27, 2001
67
US
I need to spawn another browser window using Perl. I know how to return html to the current browser window I just need to be able to send it to a fresh browser session. Does anyone know how or if this can be done?
 
I think what you have to do is open the new window from the one which calls your program, and target your link or form to that new window. Use the window.open javascript command to open the window (be sure to give it a name), and use the target="windowname" in the href or form tag that calls your perl script.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I was thinking along those lines before but had issues with having to pass all the data to the new window. However your reply got me thinking again. So my web form will call the perl script as normal which creates a pdf. And the window that spawns will link back to the completed pdf in this case. Thanks.
 
One thing you could do is dynamically create the file that you're going to call to include all of the variables in it. You can do it using Javascript. Below is an example that I used to link to Expedia.com's driving directions site. If you'd like the full page, let me know and I can post it, but here's the Javascript portion of it.

<SCRIPT LANGUAGE=&quot;Javascript&quot;>
<!--
function submitme()
{
var astr=document.findus.street.value.split(&quot; &quot;);
var str=astr.join(&quot;+&quot;);
var acity=document.findus.city.value.split(&quot; &quot;);
var cty=acity.join(&quot;+&quot;);

var myactionurl = &quot; + str + &quot;&city1=&quot; + cty + &quot;&stnm1=&quot; + document.findus.state.value + &quot;&zipc1=&quot; + document.findus.zip.value + &quot;&cnty1=4&strt2=3264+Williams+Rd&city2=Columbus&stnm2=Ohio&zipc2=43207&cnty2=4&quot;;

document.findus.action = myactionurl;
document.findus.method = &quot;post&quot;;
document.findus.target = &quot;new&quot;;
document.findus.submit();
return true;

}

Let me know if you'd like some help plugging this into your form.
 
The real issue with passing data is that I'm using a Jetform form that has its own submitting process that creates a text file with all the fields on the form then calls the specified cgi. Using the method I mentioned in the last post I thought would work but the form appears to require a return value from the cgi and since in this case I don't want to return anything I keep getting errors even though the script completes successfully. I've tried just returning &quot;&quot; but it looks like it wants an actual document as in:

$myOutStr = &quot;jetform.response.url=$displayCgi?PDF=$pdfname\n&quot;;
$myOutStr .= &quot;jetform.response.target= ${myTarget}\n&quot;;
print STDOUT &quot;Content-Type: text/html\n\n&quot;;
print STDOUT $myOutStr;

So the question is is there anyway to return something that simply keeps the browser in its current state because I do not want to loose any of my fields ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top