2
Contributors
8
Replies
10
Views
5 Years
Discussion Span
Last Post by alanlee9898
0

What does it mean by "not working"? How would we know what it is supposed to be?

To be honest, I do not like the idea of using JavaScript to download files because of security issue. This is why browsers do not allow JavaScript in the first place (but Ajax breaks through). Though, there are some people who think that it is what they want and is convenient, so they suppress the security concern. Please remember, convenience is a trade off for security/privacy.

Edited by Taywin

0

Hi,

But I just want to display a popup to indicate loading / progress bar, because the files need to download is a large data.

I'm using servlet and content-type - application/octet-stream.

You have any idea ? Because once user click the download, he have to wait about 20-50 sec. It is a csv files contains million of records.

Anyone can help ?

0

OK, so what error did you get from it? Did it silently fail? What browser did you try it on? Do you have any plug-in for browser to detect whether an error from JavaScript occurs on the page?

The plug-in requires that the browser used in this must accept cookies. It is not common that a user would set his/her browser to not accept cookies nowadays, but that's just in case. I think in your case, it is about trouble-shooting more. The back-end does not mean anything much. The application/octet-stream can be set using MIME-type (the plug-in page explains that).

0

What plug in to use? I'm using google chrome to test it.

I able to download, and loading bar with popup has show up but it doesn't close it back.

Do I need any calculation on the JavaScript ? So it know when to close it back when finish downloading.

0

Sorry for not reply earlier. Anyway, you mean you implement it from scratch. That's great.

Anyway, you shouldn't attempt to calculate the time to close. You should, instead, have another ajax call (after the pop up) to wait for the complete send file from the server to remove the pop up. I don't know your implementation, so it would be up to you.

0

Now I able to download and close the pop up on firefox browser. But for IE and chrome, it just pop up and close immediately. Do you have any idea ?

I have include Set-Cookie filedownload=true. And only firefox would wait till download is finish then only remove the cookie, whereas IE and chrome remove the cookie immediately.

0

You could read this page and this page for more information. The cookies on IE and chrome are not persisting by default. You need to define the persistance using HTML meta tag. On Firefox, it is by default.

0

Do you have example to define it using HTML tag? I able to get the cookie on Chrome but it gone too fast.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.