A multipurpose internet mail extension, or MIME type, is an internet standard that describes the contents of internet files based on their natures and formats. This cataloging helps the browser open the file with the appropriate extension or plugin. Although the term includes the word “mail,” it is used for web pages, too.
MIME types contain two parts: a type and a sub-type.
- The type describes the categorization of MIME types that are linked to each other.
- In contrast, a subtype is unique to a specific file type that is part of the type.
Here is the MIME type for HTML:
MIME types are defined in HTML by the
Distinguishing Among MIME Types
Following is a list of most MIME types, with their file extensions and the applications that use them. Many computers use file extensions to help identify file types. So, if you have a file with an odd extension on your website, you can look up the MIME type in this list.
Some types are prefixed with X, and some are prefixed with VND. These prefixes, respectively, refer to sub-types not listed with the Internet Assigned Numbers Authority or values specific to a vendor.
So I was really excited about the new integrated pdf viewer in chrome.However when I click on a pdf file link, chrome offers to download it instead of opening it inside its viewer.
How do i get it to open pdfs inside its viewer?
Edit: I have found that it behaves kinda randomly. Sometimes it does open it inside its viewer and sometimes it asks to download it.
In gmail though it always asks to download it.
Note: I already have the 'ask where to save each file before downloading' option unchecked.
6 Answers
I think that the problem sometimes occurs when the web server you are downloading the PDF from does not serve the PDF with the correct MIME type.
When the web server serves a PDF with the correct MIME type, Chrome previews it. When the web server serves a PDF with the incorrect or generic MIME type (application/octet-stream
), Chrome downloads it.
If the server returns a Content-Type of text/html
Chrome will display/open the PDF directly in the browser. However, if the server returns a Content-Type of application/pdf
then the browser will prompt the user to save/download the PDF.
Download a PDF file, then when it is done, left click on the download icon at the bottom and select 'always open this type of file' Now It should open any PDF link you click in that window without downloading it to a permanent location.
To undo it go into Options>Under the Hood tab>Clear Auto Opening Settings.
I also have the box ticked, 'ask where to save each file before download', not sure if this has any affect on the behavior of automatically opening a file.
There may be some PDFs that chrome cannot display properly, so it offers you to download it to view with another PDF viewer. It is not a full featured viewer like Foxit or Adobe
I use it this way and can find no PDF that chrome has saved, it has to cache it somewhere to read it, but I am not sure where it does.
![Cont Cont](https://1.bp.blogspot.com/-WbddLfnsRIo/WOukLUU9E7I/AAAAAAAAA8E/8swQY8NhHMUvo4Yh2c3bdfgXApbDDlKFgCEw/s1600/9.jpg)
Some more info on chrome hidden featureshttp://www.blogsdna.com/828/seven-hidden-configuration-pages-of-google-chrome-browser.htm
Hidden experimental features for version 8
about:flags
.
The behavior of Chrome (and other browsers) depends on the 'content-disposition' HTTP header. If it is set to 'inline', it will auto-open if configured accordingly. If it is set to 'attachment', Chrome will offer to save it, regardless of other configurations.In other words, behavior will vary from site to site, just like you're describing. I don't know, however, if and how it could be made to open the PDF in any case; I'm afraid this might not be possible.
The ability to auto-open PDFs was disabled in recent versions of Chrome. The developers re-implemented the feature and it is available again in Chrome 10 and above.
See this bug report for details.
Open Chrome and type 'chrome://plugins' without the quotes in the omnibox/url/search bar. Click Enable under the Chrome PDF Viewer. If you need to, restart chrome for it to take effect. Should be good to go.
No need to download anything. It's a quick fix. 1. Open Chrome browser2.type in the following where you would normally type in a web address
chrome://plugins3. enable chrome pdf viewer by clicking on Enable
Yes that simple......
Not the answer you're looking for? Browse other questions tagged google-chromepdf or ask your own question.
The HTTP standard says:
If this header [Content-Disposition: attachment] is used in a response with the application/octet-stream content-type, the implied suggestion is that the user agent should not display the response, but directly enter a `save response as...' dialog.
I read that as
But I would have thought that Content-Type
would be application/pdf
, image/png
, etc.
Should I have Content-Type: application/octet-stream
if I want browsers to download the file?
1 Answer
No.
The content-type should be whatever it is known to be, if you know it. application/octet-stream
is defined as 'arbitrary binary data' in RFC 2046, and there's a definite overlap here of it being appropriate for entities whose sole intended purpose is to be saved to disk, and from that point on be outside of anything 'webby'. Or to look at it from another direction; the only thing one can safely do with application/octet-stream is to save it to file and hope someone else knows what it's for.
You can combine the use of Content-Disposition
with other content-types, such as image/png
or even text/html
to indicate you want saving rather than display. It used to be the case that some browsers would ignore it in the case of text/html
but I think this was some long time ago at this point (and I'm going to bed soon so I'm not going to start testing a whole bunch of browsers right now; maybe later).
RFC 2616 also mentions the possibility of extension tokens, and these days most browsers recognise inline
to mean you do want the entity displayed if possible (that is, if it's a type the browser knows how to display, otherwise it's got no choice in the matter). This is of course the default behaviour anyway, but it means that you can include the filename
part of the header, which browsers will use (perhaps with some adjustment so file-extensions match local system norms for the content-type in question, perhaps not) as the suggestion if the user tries to save.
Hence:
Means 'I don't know what the hell this is. Please save it as a file, preferably named picture.png'.
Means 'This is a PNG image. Please save it as a file, preferably named picture.png'.
Means 'This is a PNG image. Please display it unless you don't know how to display PNG images. Otherwise, or if the user chooses to save it, we recommend the name picture.png for the file you save it as'.
Of those browsers that recognise inline
some would always use it, while others would use it if the user had selected 'save link as' but not if they'd selected 'save' while viewing (or at least IE used to be like that, it may have changed some years ago).
protected by Rachel GallenMar 15 at 8:50
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Not the answer you're looking for? Browse other questions tagged httpbrowserhttp-headersdownload or ask your own question.
I am using Mozilla Firefox with a PDF viewer plug-in. The plug-in has been correctly associated with Adobe Reader files to view them in the browser in the settings.
I would like to be able to view PDF files in Firefox rather than downloading them. This already works correctly when a web server indicates that a file has the Content-Type
of application/pdf
. However, some web servers provide other Content-Type
s for PDFs, such as application/octet-stream
. (See this example of a PDF served with a non-pdf Content-Type
.)
I have looked at Firefox's MimeTypes.rdf file, and it appears to only support mapping applications based on file extensions for non-Internet-based files. (It looks like it only uses Content-Type
to map Internet-based files.)
How can I have Firefox view all PDF documents in-browser rather than only the ones with the application/pdf
Content-Type
?
What Is An Octet Stream
2 Answers
Firefox has no content inspection code (e.g. the linux file
command) to detect the actual content type and rely on the Content-Type
header.
Workaround: mozplugger
extension
See man 7 mozplugger
:
Workaround: human interaction
Save the file and open it in the file explorer ;-)
Workaround: misconfiguration
An additional workaround is to hack mimeTypes.rdf
and assign application/octet-stream
to the same value as application/pdf
.
I don't advice this workaround.
You can use Force Content-Type extension for pdf files with wrong Content-Type
response header.
For example if web server provides Content-Type: application/octet-stream
you can add rule to transform it to Content-Type: application/pdf
based on pdf file url, like this: