解决ie下载apk后更改后缀名为.zip的问题

转自:http://www.cnblogs.com/niuniu/archive/2012/03/06/2381811.html

解决:

服务器添加MIME类型:

 application/vnd.android.package-archive apk;

 其他类型添加:

text/vnd.sun.j2me.app-descriptor      jad;
application/java-archive              jar war ear;
application/x-java-archive-diff       jardiff;
application/vnd.android.package-archive apk;
application/vnd.ms-cab-compressed     cab;
application/octet-stream              bin exe dll;
application/vnd.symbian.install       sis;
x-epoc/x-sisx-app                     sisx;
application/iphone                    pxl ipa;
application/vnd.palm                  prc pdb;
application/vnd.webos.ipk             ipk;
application/vnd.rim.cod               cod;
application/mrp                       mrp;
x-nokia-widget                        wgz;
application/octet-stream              deb; 

服务器添加方法:
1. a标签方式的添加,如下:

 

<a type="application/vnd.android.package-archive" href="xxx.apk">下载</a>

 

2. web.xml配置:
在我们的project中如果我们拦截的action是"/"的话,往往要配置一些静态资源的后缀default配置,这时我们来配置apk类型的MIME也是可以的,目的就是让浏览器知道我们的文件类型,代码如下:

<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.apk</url-pattern>
</servlet-mapping>
 <mime-mapping>

   <extension>apk</extension>

   <mime-type>application/octet-stream</mime-type>
 </mime-mapping>

 

 

你可能感兴趣的:(zip)