Hi! When a ms word document link is downloaded, it is automatically embedded in the browser. Is there a default path where this files are saved when downloaded. Because the save/open dialog box doesn't appear with microsoft office files. or can i force the save/open dialog box to show up with an ms office file link. thanks. ellai [ February 03, 2002: Message edited by: ej dinglasan ]
(IMHO) Rather stupidly, the behaviour of Word documents in IE is a property of the operating system and not the browser... You can make it open the 'save as' box and bypass the plug-in by opening a File explorer window, view menu, Options... Click the 'File Types' tab, scroll down to 'Miscrosoft Word Document', select it then click the 'edit' button, then select the box saying 'Confirm Open after Download'. These directions are based on NT4, should be the same or similar in newer versions but there's no telling with M$... ...or I might have misunderstood your question completely. Dave.
Joined: Jan 22, 2002
hi! can i do this programmatically because im not the client but the server.
I'm not sure, but there may be a way of forcing it using a combination of content types and Disposition headers... Essentially you have no control over the way content is handled at the client side, since it gets managed in 'the standard way' for that content type. eg The default for a Word doc is to open it using the plug-in for the browser. It could just as easily be to play the song, display the movie, etc etc. Usually a browser will use the content-type returned by the server to decide what to do with the content. If you say the content is 'text/html' it will be displayed differently to 'text/xml' or 'text/plain'. The problem with downloading files is that if a content type is not specified, the browser can use the file extension to determine the content type. A way of hacking this could be to return the content without specifying the content type (or defining some other type of content?) then use the disposition header setting to define the filename. I doubt it would work tho. Your best bet is to zip the docs or tell users to "right click and download" Dave
The way the content type of a file is determined is based on the web server and the browser that you are using. For IIS and IE(4 and up) it works like this:
When a document is requested, the server looks up its MIME type based on its extension and passes it back in the HTTP response header.
If the server returns "unknown", then that is assumed to be the correct MIME type for the document in question.
If the server returns a known or ambiguous MIME type (text/plain or application/octet-stream are considered ambiguous), then IE will attempt to verify the result using hard-coded tests for the 26 most common MIME types. If it can be verified, then the appropriate viewer or plug-in will be used to open the file.
If the server-provided MIME type cannot be verified by testing for the most common 26 MIME types, a weak data-type verification will be performed. If the Server-provided MIME type is primarily text and text is read from the buffer, it passes. If the Server-provided MIME type is primarily binary and binary data is read from the buffer, it passes. In either of these two cases, the Server-provided MIME type is used.
If the server-provided MIME type is known or ambiguous and it could not be verified by testing for the 26 most common types, and it could not be verified from the first 256 bytes in the buffer, and the data type validation failed, then the file extension will be looked up in the system registry.
If the MIME type is found to be "unknown" in the registry, that will be the MIME type used. If it is found to be ambiguous or known, it will be rejected as invalid (it should already have been found by previous tests if the content matched an ambiguous or known MIME type).
If all previous tests have failed, the registry will be checked for applications that handle the document's extension. If one is found, the MIME type is set to "application/octet-stream" and the application will be used to open the document.
If all tests failed, the MIME type will be set based on the data type found in the buffer scan. If text, then "text/plain". If binary, then "application/octet-stream".
Given this method of determining the MIME type of a document, it should be possible to trick the browser into downloading a Word document. Go into IIS and add a MIME map for .doc as "application/guess". If that doesn't work, try "text/plain". One of those two should do the trick. HTH