I have a reponsive bootstrap application and while trying to open the pdf from mobile getting error. I am able to open the pdf from iphone however from android chrome it says "media not supported exception"
I have my application type as "octet-stream"
Thanks for your help.
The application/octet-stream MIME should only be used when you don't know what the file contents is going to be, as it's for arbitrary binary data. The receiver has to attempt to work out what type it is, based on it's content and/or file extension.
You should be always use the appropriate MIME if it is known:
Content-Type: application/pdf
Content-Disposition: attachment; filename="document.PDF"
Related
I have the endpoint with Content-Type: text/csv.
There's no Content-Disposition header!
When I open this endpoint in browser it offers to download this file like if it has Content-Disposition header.
What I would like to achieve is just view the endpoint response in browser the same way it would do this for Content-Type: text/plain.
No downloading, no opening with default program - just viewing the response.
Is this at all possible at any browser?
I tried Firefox and Chrome.
If you can add a Content-Disposition header, setting the value to incline would solve this for you.
Content-Disposition: inline
I'm trying to determine the mime type of a file. In Firefox, it shows text/cache-manifest. In Chrome, F-12 -> Network Tab it shows under type as document. When I view the response headers, it never shows Content-Type so maybe my server isn't sending it? Or am I interpreting document wrong?
In .htaccess, I have: AddType text/cache-manifest .manifest
EDIT: I have also tried the below code and it still shows type as document in Chrome:
manifest.php
<?php header("content-type: text/cache-manifest");?>
Network tab filters query based on request type, not mime type. As you request it as document (simple http get request in browser, not for example from image or styles tag), then it shows it as type=document.
See https://developers.google.com/web/tools/chrome-devtools/network/reference for more info.
We have a web application which offers a file named L_2804071.key for download. The download works fine in Internet Explorer and FireFox but in Chrome it "loses" the filename and chrome does not seem to recognize the filename in the content-disposition header.
Here is the full header (identical in both browsers):
content-disposition: attachment; =?utf-16le?B?ZmlsZW5hbWU9TF8yODA0MDcxLmtleQ==?=
I don't know if this helps but if you decode =?utf-16le?B?ZmlsZW5hbWU9TF8yODA0MDcxLmtleQ==?= you get Wfilename=L_2804071.key which looks weird. Not sure where the "W" comes from but IE seems to work with it and downloads a file named L_2804071.key.
Fix the web application to return a Content-Disposition header field that follows the spec, your example is invalid (for starters, there's no "filename" parameter). Note that your example appears to use RFC2047-style encoding, which in general isn't used in Content-Disposition.
See http://greenbytes.de/tech/webdav/rfc6266.html for details.
Don't know why I'm facing this issue not able to download pdf files in chrome browser, it is showing below error in Nginx server.
resource interpreted as document but transferred with mime type application/octet-stream pdf
Though I have included mime type as application/pdf
If it's just a warning then simply ignore it! It's just Chrome.
If not, try to include MIME Type as application/octet-stream.
try to use those examples in your code.
PDFobject
this is a classic one:
if you can load localhost:8080/xyz123/PdfFile.pdf
then write like this:
<iframe src="./xyz123/PdfFile.pdf" title="title">
...
</iframe>
Similar issue came up for me only for .pdf files. I changed the Application Pool's idenity to Network Service and it fixed the issue.
I am not sure why it worked as the response header still had the same Content-Type, but it worked.
I have a problem with my feed's content-type:
When I set the content-type to "application/rss+xml" or "application/atom+xml" the Firefox will render it current (and displays the default subscribe page), but the Chrome renders it as "text/plain". When I change the content-type to "text/xml" or "application/xml" both Firefox and Chrome render it as a xml document (and Firefox will not show the Subscribe page).
Have you any idea or suggestion? Which content-type should I use for rss.xml and atom.xml?
The MIME type application/rss+xml is not recognized by the IANA, though some RSS-consuming applications support it anyway.
Because it's not recognized, the only official MIME type to use is text/xml.
Atom feeds do have the official MIME type of application/atom+xml.
You should use the exact type that is specified for that file format. Chrome itself doesn't do anything special with application/rss+xml or atom+xml and then when things such as registerContentHandler or web intents land applications will be able to interact with these types.