TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
Re: Automatic software downloads from an HTML page?
Subject:Re: Automatic software downloads from an HTML page? From:"Edgar D' Souza" <edgar -dot- b -dot- dsouza -at- gmail -dot- com> To:"Geoff Hart" <ghart -at- videotron -dot- ca> Date:Thu, 23 Aug 2007 11:25:25 +0530
Geoff:
First, the "delayed auto-download":
Basically, the last page sent to the browser sets a timer that waits
for n seconds and then uses a "pull" to fetch the file from the
server.
Please see the source of the attached HTML page (may not get through
to the list). I grabbed this source from some site on the Net and
modified it slightly to invoke the javascript function to pull down
the files as soon as the page loads (it was earlier just a simple
clickable link).
To get the 5-second delay that you mention, you'll need to change the
onLoad code of your page to use the setTimeOut Javascript function
(it's well documented on the Net, a quick Google should get you enough
info) with the desired delay (5 secs?) , and the other parameter the
name of a small function which is to be called at the end of that
timeout. In this case, that would be another little Javascript
function you add to the page, called "getTheseFiles()" that simply
includes the call to the downloadFiles() function, and the names of
the zip files. This is not only useful for passing a single,
uncomplicated function name parameter to setTimeOut(), it's also
useful in the next part... To provide the "or click this link if
download doesn't auto-start" link, you would probably set that link's
target to "javascript:getTheseFiles();" as well. That means that your
page MUST have Javascript running in your buyer's browser.
Alternatively, if they can only buy one file at a time, you could set
the target of that link directly to the zip file to be downloaded, so
that your buyer can fetch it even if they turned off Javascript in
their browser.
Part 2: I presume you will be selling multiple downloadable files, and
will want the version of the code above to be customizable for
different files. This is the part which involves server-side
scripting: changing the names of the file(s) to be downloaded to those
which your customer's buying.
How this code will be written is highly dependent on what you're using
as the server-side scripting language, as well as the framework (the
shopping cart app you mentioned). In concepts only, the server-side
script is expected to "know" which files a particular buyer has just
paid for. The simplest way to do that would be to include a
querystring parameter (another of those "&variable=value" parameters
tacked onto the URL) in the URL you give PayPal as the "redirect after
payment" page. This could perhaps just be a serial number of a file,
or something similar - the page PP redirects to should receive this
parameter, do a little lookup and decide that "55642" actually means
"/downloads/foobar.zip." It should then rewrite the contents of your
intermediate "getTheseFiles()" function to contain the URL for
foobar.zip.
Another way would be to have your server maintaining a "session" for
each buyer, and only the session identifier is sent along in the
redirect URL you give PPal. Alternatively, you don't even send that;
the session identifier gets saved as a cookie in each visitor's
browser, PPal is given a bland "afterpayment" URL minus any
identifying parameters; once payment is done, the redirected-to page
on your site has code asks the buyer's browser for the sessionID
cookie, and then looks up what that particular person was buying/had
in their cart before they went to PPal, and proceeds to rewrite the
contents of the "getTheseFiles()" function based on that.
Finally, the shopping cart thing: there are plenty of free/open-source
shopping-cart frameworks out there (freshmeat.net, sourceforge.net),
which you can download and hack. Sending download links via email
should not be required if you can find one that centers on your idea
of an off-site payment page that simply tells your shopping cart that
that visitor has paid for their purchases. I'm afraid I haven't tried
out any of these cart thingies myself - so can't recommend any one in
particular. Perhaps other members have recommendations?
HTH
Ed.
On 8/22/07, Geoff Hart <ghart -at- videotron -dot- ca> wrote:
> For various software utilities that I've downloaded, the Web site
> typically offers an automatic download function. For example, after
> filling out an HTML form to register my name and address, I click a
> Submit button, and once processing of the form is complete, the Web
> site redirects me to a download page. A typical page has the message
> "click here if the download doesn't start in 5 seconds", with a link
> to a file or file handler. Usually, the download begins
> automatically; if not, clicking the link starts the download.
>
> So: How is this done? Is it a simple matter of specifying the URL for
> the file on the server? Does it require .ASP programming or a CGI (or
> other) script?
>
> What I'd like to do is use Paypal's "but it now" buttons to handle
> the payment processing for a downloadable file. The documentation for
> this feature states that you can specify a redirect page (i.e., the
> next page the Web browser should display once payment processing is
> complete), so in theory, it should be possible to provide the URL of
> an automatic download page, and the file should download automatically.
>
> In practice? Who knows! Has anyone tried this? Any obvious drawbacks
> I'm missing? I do have a shopping cart installed (CubeCart), but I'm
> not happy with how it works... it's not a particularly efficient
> interface, and the software e-mails a link to download the file
> instead of automatically downloading the file, and the e-mail is
> eliminated by spam filters more often than I'm comfortable with.
>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create HTML or Microsoft Word content and convert to Help file formats or
printed documentation. Features include support for Windows Vista & 2007
Microsoft Office, team authoring, plus more. http://www.DocToHelp.com/TechwrlList
True single source, conditional content, PDF export, modular help.
Help & Manual is the most powerful authoring tool for technical
documentation. Boost your productivity! http://www.helpandmanual.com
---
You are currently subscribed to TECHWR-L as archive -at- web -dot- techwr-l -dot- com -dot-