Trying to Force IE to download...

Results 1 to 4 of 4

Thread: Trying to Force IE to download...

  1. #1
    NolesNC Guest

    Default Trying to Force IE to download...

    A file instead of loading it, even if the browser machine has a local association for it (for example, IE auto loads Word and Excel files. I&#039d like to have a link to those files, and have it just give the user a "save as" dialog box instead of actually loading the document). I know you can just tell the user to <right-click> then <save as>, but I was hoping to elimate that step. Any ideas?

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: Trying to Force IE to download...

    Have you tried<BR><BR>&#060;a href="PathFilename"&#062;Download&#060;/a&#062;

  3. #3
    NolesNC Guest

    Default RE: Trying to Force IE to download...

    Yup, that still doesn&#039t prevent being automatically loaded by IE if their is a local file association.

  4. #4
    C.W. Guest

    Default RE: Trying to Force IE to download...

    IE can be a pain when doing this. First it is helpful to understand how browsers determine file association.<BR><BR>When a file is sent down from the web, the websever has a mimetype association image/GIF for a GIF picture or text/HTML for HTML for example, and sends that information in the header of the data being sent to the browser. The browser identifies the mimetype and using its own lookup tables, decides what it should do with the file. If it is a "known" file type it invokes whatever program on the client it needs to. text/HMTL is handled by the browser for example, application/msword is handled by WORD if it is installed. <BR><BR>SO, if you are downloading a *.DOC file the SERVER identifies that a DOC exention has a mimetype of application/msword, and sends this information along with the file to the client. If the client recognizes the mimetype, it will try to launch the application that ties to that filetype.<BR><BR>There is a mimetype that always (almost always, see below) prompts for run from server/save to disk. And that is : application/octet-stream usually reserved for exe files.<BR><BR>Ok, the tricky part about IE, and this is from my experiance with IE 3+4, I have not tried this with 5+ and it may be fixed. is that IE sometimes ignores the mimetype and uses the extension of the file coming downstream to lauch the appropriate application. Keep this in mind if you try to test the following solutions.<BR><BR>There are 2 ways to handle this: <BR> 1. You can change the mime type for *.DOC files on the server to a binary mime type, which you may not want to do for all files, or<BR><BR> 2. You can follow the below to write a program to alter the mimetype header entry when delivering the file:<BR><BR><BR><BR>Try setting the response.ContentType = to a binary/exe file.<BR><BR>In order to do this, your download will have to be processed by an ASP program. This ASP will <BR><BR>1. Set the ContentType<BR>2. Use FSO to read in the file and then output the complete contents of the file using response.write or response.binary write (depending how you read the file in).<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts