I'm on my java web page and when I download a file and refresh the page said file is downloaded back to me
Asked
Active
Viewed 299 times
-4
-
Presumably you forgot to add "how do I prevent it?", right? The answer would've been: https://stackoverflow.com/a/6320124/1240557 – kryger Nov 23 '17 at 15:34
-
Because you request the same resource again. If your browser treats that resource as a downloadable file, then you will download it again. Why is that behaviour unexpected to you? – f1sh Nov 23 '17 at 15:35
1 Answers
0
When you refresh your page, you send the same request again. It is not an issue but a feature. Sometimes, web browsers don't update address bar with downloaded resource uri, but store and continue to use it.
If you store ID of downloaded resource in user session, you can allow only one download, but in this case, it is necessary to ensure if resource has been downloaded with success in first time.

Rey0bs
- 1,192
- 12
- 19