下载APK在Chrome浏览器中不起作用

时间:2018-07-21 15:42:10

标签: java android google-chrome

    Hi,

    My website have a option to download the apk file. File getting download in all other android browsers except chrome. Getting warning as "Resource interpreted as document but transfered with Mime type application / octet-stream". I have implemented below codings as well. But not working. Can you please help for this issue. 

    Java code :
  

字符串文件名='Sample.apk';       字符串filepath ='/ resources / mobileapp /';       MimetypesFileTypeMap mimetypesFileTypeMap = new MimetypesFileTypeMap();       response.setContentType(mimetypesFileTypeMap.getContentType(filepath +   文件名));       response.setHeader('Content-Disposition',“ attachment; filename = \”“ + filename +” \“);

1 个答案:

答案 0 :(得分:0)

这意味着服务器正在通过以下方式发送Javascript HTTP响应

Content-Type: text/plain

您需要配置服务器以发送JavaScript响应

  Content-Type: application/javascript