Forum Moderators: coopster

Message Too Old, No Replies

Prevent browsers from automatically starting a download

         

pixelpan

4:47 pm on Jun 12, 2008 (gmt 0)

10+ Year Member



I am creating a script to keep download statistics, but I would only like to update the stats if the file was actually downloaded. I have looked at these posts:

[webmasterworld.com...]

and

[webmasterworld.com...]

The problem is that browsers automatically start downloading the file while the 'save/open' dialog is still open. This means the file can completely download (into a browser specified temp directory I assume) before the user has specified where to save it. They may even decide to cancel the save, even though the file was successfully downloaded. Is there some way (without Javascript) to tell browers to not automatically start downloading? Some HTTP header perhaps?

eelixduppy

3:54 am on Jun 16, 2008 (gmt 0)



Hello and Welcome to WebmasterWorld!

I'm not sure I understand your problem. How does the file download before the user selects where to put it? I'm not sure I've seen this before. Maybe it's browser specific because I don't think there's anything you can do about that in that case.

pixelpan

4:22 pm on Jun 16, 2008 (gmt 0)

10+ Year Member



I know both Firefox and IE do this. They begin downloading the file to a temporary directory. In any case, upon further thought, I realize this really is a client side issue, and I am inclined to think there is no way to deal with this from a server side standpoint. I suppose all statistics that track downloads are somewhat unreliable for this reason.