my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes File download error in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "File download error in javascript" Watch "File download error in javascript" New topic

File download error in javascript

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 186

Dear Friends,

I am trying to write a file download app. The file to be downloaded is a plain text file. I'm using the following JavaScript function, which will hit the server and get the file content.

A new window is opened but when i'm getting an error response like this:
Internet explorer cannot download somefile from localhost.

I'm setting the following headers in the HTTP response at the server side:

My browser version is IE 8. This is working in latest version of chrome.

Please help in resolving the issue. Also, how to get Open/Save/Cancel dialog box when is triggered and the response is obtained from the server?

I agree. Here's the link:
subject: File download error in javascript
It's not a secret anymore!