Koen
Koen

Reputation: 3683

How to determine download file name when there's no content-disposition

Take a look at this URL:

http://download.mozilla.org/?product=firefox-9.0.1&os=win&lang=nl

It is the direct link to download the latest version of Firefox. When you execute the URL in Chrome, IE, Firefox, Safari, etc. they all suggest the file name "Firefox Setup 9.0.1.exe". If you look at the response headers there's no content-disposition header. The URL obviously also doesn't contain the name. Where do these browsers get the suggested file name?

Upvotes: 0

Views: 350

Answers (1)

minimalis
minimalis

Reputation: 1953

When you visit the URL, the server sends a "302 Found" redirect response with Location: http://mozilla.mirror.ac.za/firefox/releases/9.0.1/win32/nl/Firefox%20Setup%209.0.1.exe

Your browser redirects here and this is where the filename comes from. If you install a proxy such as http://fiddler2.com/ (on Windows) you'll be able to see exactly what's going on.

Upvotes: 1

Related Questions