Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT: Why won't Chrome & IE download file, where Firefox will?

I have some binary files in Tomcat webapp folder, that I wish user to download.

I have following code: Window.open(GWT.getHostPageBaseURL()+result, "_blank", "");

I checked with GWT.log path, and it's correct - it really points to folder with certain file.

Firefox: Downloads every file as expected (either opens image/xml in new tab or prompts save dialog)

Chrome: Seems to be downloading only .zip from what I tried. Others are ignored, nothing happens.

IE8: Opens image/XML in new IE Window. Others are ignored (f.e ZIP blink new window but won't prompt save dialog)

What am I doing wrong? Thanks

like image 311
Xorty Avatar asked Jan 28 '11 11:01

Xorty


People also ask

Why is my Chrome not allowing downloads?

This error means that your computer's security settings blocked the file. Learn more about blocked downloads. On Windows: Windows Attachment Manager could have removed the file you tried to download. To see what files you can download or why your file was blocked, check your Windows internet security settings.


3 Answers

I'd suggest using a tool like Fiddler to diagnose this problem by examining the HTTP requests and responses in more detail.

My hunch is it'll turn out to be a mime-type issue, but it's hard to say much for sure without seeing more of what's going on.

like image 65
Spudley Avatar answered Oct 25 '22 06:10

Spudley


According to this discussion from GWT-group problem with chrome can be that it blocks popups generated by javascript(or callbacks in GWT), but allows to open new window if it's result of user interaction(or button click in GWT).

like image 33
Ilia Akhmadullin Avatar answered Oct 25 '22 06:10

Ilia Akhmadullin


I recently built something for our organisation more as a cache-buster for use with IE than anything else.

If you could check your output script has the following in it, somewhere at least:-

response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "max-age=0");
response.setHeader("Content-Disposition", "attachment; filename=\"" + yourfilenamehere + "\"");

Hope this is of some help anyway. The content-disposition thing seemed to be the one that was flaking IE out to be fair, but the caching ones are just practice in my opinion when pulling a file from disk.

Good Luck with your fix!

like image 24
BizNuge Avatar answered Oct 25 '22 07:10

BizNuge