Well, since you've asked in a Perl forum, here's a Perlish solution:

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:

# 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]; }
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.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.