A
A
appplemac2012-04-22 16:28:32
Nginx
appplemac, 2012-04-22 16:28:32

Files not loading in Chrome 18?

Welcome all.
There is the following part of the Nginx configuration:

location /download {
alias /media/web;
types { }
default_type application/octet-stream;
}

In theory, all files that have a link like mysite.com/downloads/abcd.pdf should be immediately downloaded by the browser.
This happens in Firefox, but not in Chrome.
Tell me, what could be the matter?
Chrome 18, Firefox 11 on OS X 10.7.3.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VBart, 2012-04-22
@appplemac

By setting Content-Type: application/octet-stream, you only deprive the client of the ability to recognize the file type from the headers. In some browsers, this results in the download of the file.
To download files, you need to use the Content-Disposition header with the attachment parameter. Spoiling the Content-Type is not worth it, because you thereby prevent the browser from prompting the user to open the file immediately after downloading in the desired program.
tools.ietf.org/html/rfc6266

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question