Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Gentlemen, here is a quite interesting issue, take a look at:

UrlFileOnTheServer.click();
window.location.reload(true);

The sequence of actions is clear: at first I request a Save as Dialog and then the page is reloaded but the result depends on the browser I use.

It works properly well in Chrome, FF, Opera - Save as dialog is opened and the page is reloaded LIKE A BACKGROUND stuff. But IE 10,11 does not perform like I wish: the save as dialog does not appear at all. What is the trick?
Appreciated!
Posted
Comments
Sergey Alexandrovich Kryukov 11-Jun-15 11:40am    
The trick is: the user knows better when doing "Save As" and does not like dirty tricks.
—SA

Get the server to send the Content-disposition: attachment header:
How To Raise a "File Download" Dialog Box for a Known MIME Type[^]

... as I told you last week[^]! :doh:
 
Share this answer
 
v2
Comments
Dzianis Igaravich Leanenka 12-Jun-15 7:49am    
Thanks, but you are wrong!
Richard Deeming 12-Jun-15 7:50am    
No, I'm not. I've used this solution numerous times, and it always works.
Dzianis Igaravich Leanenka 12-Jun-15 7:52am    
you solve what is not needed actually) But thanks
Richard Deeming 12-Jun-15 7:54am    
Well, I solved the question that you asked.

Sorry, my psychic powers don't stretch to reading your mind to work out what you actually meant to ask, instead of what you wrote! :)
Please, read the task a bit attentively! And I will tell you the issue in detail. The trick is not in the "download" attribute, the trick is that the window is reloaded in IE before Save as dialog is opened. And Save As dialog is opened before the reloading in all the rest browsers...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900