Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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".

share|improve this question
add comment

migrated from webapps.stackexchange.com Dec 21 '10 at 9:02

This question came from our site for power users of web applications.

2 Answers

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").

share|improve this answer
    
+1 for nice reply –  Dave Dec 21 '10 at 10:51
add comment

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.

In PHP:

<?php
// 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
readfile('original.pdf');
?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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