jQuery(?或任何其他weblanguage),是否可以查看客户端是否正在下载文件

I want to make a website containing a frame (div would work as well) with an external page inside of it, once the user downloads a file on the page in the frame, I want to trigger an event. Filedownload is triggered by a form submission. Is this possible? Thanks. EDIT: I can code PHP, ASP, jQuery and a tiny bit of Java, but I'm always willing to learn more.

Could I replace the form's action to a different file which'll redirect the POST data to the original form action page but will also receive the GET data. I'm sorry I'm probably not using the right terms.

When the user clicks the submit button on the form, jQuery can trigger a function to run.

jQuery("#downloadLink").click(function(){alert('user has clicked the download link');});

*Note:*This would execute when the user starts downloading, not once the download is complete.

EDIT: this would not require access to the external page's code, and you wouldn't have to manipulate the action of the form at all.

You can detect the start of a download with some tricks, but not the end of the download.

To detect the end of the download you you may be able to have the server than sends the download help you.

To detect the start have the download page first execute some javascript code that tells you "download started", something like window.parent.downloadStarted() and have a downloadStarted() function in the parent window.

Then after running that have the iframe redirect to the real page that does the download.

To detect the end of the download the program feeding the download would have to signal it. The best bet is to use APC and set a variable, then constantly poll a second page that checks if the variable was set or not, and reports back.

Not mine, but I found this reference that supposedly uses AJAX http://www.sitepoint.com/forums/showthread.php?618233-Detecting-File-Download-Completion

To expand further: Browser event when downloaded file is saved to disk

You can use some gimmicky stuff to tell when the client has disconnected, but still seems like you might get false positives in some situations.