ASP.NET page: how to call javascript method when server returns file for download
===

I have an ASP.NET page where a request is made and after a while server returns either new page or just file for download. I want to indicate on screen s  that server is "Processing..." while it takes time before returning data.

To call javascript when user hits submit is easy. Also reload of page on Postback causes any "Processing..." indicators (some DIVs popping up at the top of page) to go away.

My problem is mostly cases when data returned by server is not a page but a file to store. How can I catch the moment that server started to return data, and run a javascript/remove "Processing" DIV ? Is it even a way to do so in case of reply of different mime type?
In which cases it is even possible?