Write a Perl script to load the html page in question and return it with a content disposition header. Then make your button call that Perl script.
Your html Page:
<html> ....... <a href="../cgi-bin/my_download_script.pl?url_of_this_page"><img src=" +button.gif"></a> ....... </html>
Your Perl script, in pseudo code:
The content disposition header as "attachment" forces the browser to open a dialog asking whether you want to open it or save it. Choosing "Save" opens the "Save as" dialog.# get url substring from $ENV{'QUERY_STRING'} $filename = $ENV{'QUERY_STRING'} open(FILE, $filename) or dienice("cannot open file $filename : $_[0] $ +!"); @LINES = <FILE>; close(FILE); print "Content-Disposition: attachment; filename=$filename\n\n"; for $i (0..$#LINES) { print $LINES[$i]; }
There are many possible variations on the html and the Perl. It could have been a form button instead of an image. You could use 'while' instead of loading into an array, you could use javascript to pass the url string so that you could create a standard button routine that just needs to be cut and paste into every page without custom-coding the url substring....
Forget that fear of gravity,
Get a little savagery in your life.
In reply to Re: Ctrl S function in PERL
by punch_card_don
in thread Ctrl S function in PERL
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |