How to open a pdf url which does not have a .pdf extension?

I am trying to open a url which is actually a pdf file but it does not have .pdf extension in android webview BUT it does not works. It directly downloads. But when i open the url in WEB browser, the pdf file opens perfectly. Since this url does not have .pdf extension, I can not use google docs as well. Also tried to download and open the file using any pdf viewer app, it also fails. The main reason is my Url does not have .pdf extension. Is there any other solution?


I think you are not setting the content type as pdf(MIME). Thats why you are getting problem when you are downloading the pdf content.

See this post for more details.

Proper MIME media type for PDF files

MIME TYPES

Render a PDF file using Java on Android


你可以看到这个.pdf扩展名是没有必要的

链接地址: http://www.djcxy.com/p/8190.html

上一篇: 限制要上传的文件类型

下一篇: 如何打开没有.pdf扩展名的pdf网址?