cordova打开pdf连接没反应:transferred with MIME type application/pdf: "http://**/**.pdf"
来源:互联网 发布:朝勇投资有限公司 知乎 编辑:程序博客网 时间:2024/06/03 14:56
在开发中有这样的一个需求,cordova项目的h5页面上有pdf文件的连接,在web端点击连接可以用流量器打开pdf,在手机端点击连接应该会用手机浏览器访问连接,然后弹出下载或者直接打开的提示。
问题是用浏览器可以打开连接,但是在应用中点击没反,用google浏览器调试应用,在控制台这样一条日志:Resource interpreted as Document but transferred with MIME type application/pdf: "http://***/***/**.pdf",看起来意思就是不支持pdf类型,当时找了很久才找到解决办法。
原因是这样的cordova项目默认用手机本地浏览器打开http连接,但是如果在xml文件下的config.xml里面配置了<allow-navigation href="http://*/*"/>,意思就是要cordova用内置方式打开http连接,但cordova内置的方式不支持打开pdf,所以点了也不会有反应。
所以把这行代码删掉,再在应用中点击http连接就可以用手机浏览器打开了。
0 0
- cordova打开pdf连接没反应:transferred with MIME type application/pdf: "http://**/**.pdf"
- 关于easyui Resource interpreted as Document but transferred with MIME type application/json
- Resource interpreted as Stylesheet but transferred with MIME type application/x-css
- Resource interpreted as Font but transferred with MIME type application/x-font-woff
- Resource interpreted as Document but transferred with MIME type application/json ...
- ThinkPHP Resource interpreted as Document but transferred with MIME type application/json 导致js无效
- SpringMVC Resource interpreted as Script but transferred with MIME type application/octet-stream:
- Resource interpreted as Document but transferred with MIME type application/json:
- Resource interpreted as Stylesheet but transferred with MIME type application/octet-stream
- 坚持#第37天~Java开发大数据实时统计系统
- 关于Integer对象的一些小知识
- 数组中只出现一次的数字
- repo切换xml命令
- 线性顺序存储结构
- cordova打开pdf连接没反应:transferred with MIME type application/pdf: "http://**/**.pdf"
- Cookie和Session的区别
- 网络令牌的解释
- 周三项目4--顺序表应用
- 编译和解释的区别是什么?来看看
- 初学java,对3+1层架构的一些简单理解:MVC+S
- 构造函数的识别
- 你知道为什么Android手机总是越用越慢?
- CSDN 深度学习优质内容