On Monday 22 September 2008 12:38:21 pm shnaxe wrote:
> dear readers,
>
> i recently finished a small perl-cgi download script that sends files
> after some checks and logging. i call this script through a link on a
> static html-page and pass the file-id as a parameter.
>
> this all works nice so far, the part where i'm stuck at is that with
> clicking on the link, the page containig the link is replaced by a
> white blank page. i wonder how i could instead get either:
> - the page containig the link stays, link is targeted to a new window
> (minimal version)
> - a new page is displayed containg something like 'thank you for
> downloading... you download should start now...' (deluxe solution)
>
> for the minimal version, i thought putting a simple 'target="_blank"'
> into the link should do what i want (only tested with firefox 3.0 so
> far). this indeed works, but the focus changes to the popping up new
> blank tab and further, this tab stays open after the file is
> transferred. i remember having seen this differently on the web.
>
> for the deluxe verson i think i somehow need to send out two headers,
> one of type 'application/x-download' (for the file) and another of
> type 'text/html' (for the page).
> but how would i do this? i'm afraid that the second header (whichever)
> will not get recognized as a second document but be embedded into the
> first. i guess a short sleep between the first and the second header
> won't do it...
>
> thanks for help and suggestions in advance,
> regards, shnaxe
>
> ps: well, i am unsure if this would have been better posted to another
> group (but which) since its maybe not a pure perl-question. i got to
> admit that from my point of knowledge, the solution to the problem i
> described seems to be somewhere on a blurry line between perl/cgi and
> html...

you could use Java Script  , the history function  , in your Perl script  do 
something like this

assuming your using CGI.pm ,  if not you should.

use CGI;
my q = new CGI;

print $q->header(),$q->start_html;
print '<script language="JavaScript">'."\n";
print 'history.go(-1);'. "\n";
print '</script>'. "\n";
print $q->end_html;

this will force the browser to go to the page that launched the  called Perl 
script.

hope this helps  some. just one of many ways of doing the same thing


Greg

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to