views:

24

answers:

2

In javascript, how can I detect when the browser brings up the open/save/cancel prompt when loading a file?

If possible, is it the same for all browsers?

I'm trying to fix a problem with users clicking a download button, being impatient and clicking it again, and again which is taxing our servers. I tried just hiding the button while the file is processed, but the icon will come back before the open/save/cancel prompt shows up.

The code goes something like this: ... users clicks button, button hides, external process gets the file, button appears ...

+1  A: 

You can't.

How the browser deals with a requested resource - open it, start an external application, offer a "save" dialog - is outside of what you can control using JavaScript.

Pekka
All I want to do is detect when it comes up. Is that not even possible?
chemdt
@chemdt nope, definitely not.
Pekka
A: 

You can't! No way, that's it!

Marco Demajo