When creating a website, depending on how a browsers Mime-Types are setup, downloading attachments can have different behaviors. Is there a website that talks about this and suggests a rule-of-the-thumb that should be taught to all web developers?

For example, among these methods shown below (which doesn't account for all the possibilities), which is preferred and why?

  1. Click the download, prompt with "Save or Open" dialogue and if they choose "open" then open with the Windows default program.

  2. Click the download, prompt with "Save or Open" dialogue, show a "remember this" checkbox, and then open using the web browser in a new window.

  3. Click the download, auto detect the browser mime type and immediately open. Don't save unless they right-click the link and choose "Save As".

2 Answers 2


Well, there are some problems with what you have suggested: namely, different browsers and attachments means that users are going to be doing all sorts of things with attachments.

The unsaid rule of thumb is to use the correct mime-type, provide a download link, and let the user handle the rest.

You go into a little bit of detail about the various (IE) dialogs that may be presented to users - but, the developer doesn't have control over this dialog, it is taken care of automatically. For example, in Chrome, the default action is to start (but not finish) the download and prompt the user down in the bottom download bar about it, there is no pop-up.

Try to avoid those unnecessary details about dialogs, just provide them a link that does what the user would expect it to. The best policy when dealing with users is to make things as intuitive and easy for them as possible (users don't want to think about how to do things, they want it to "just work").


I completely agree with @rlb.usa said. You should just provide the link to the file and let user handle it as he wants / is used to.

If you want to force files to be downloaded (for example, like a PDF, which can be read online if user has proper plugins), you can use some headers to handle that.


// We'll be outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');

// The PDF source is in original.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.