Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Chrome Browser download APK from link

I have a link to download an Android APK on my website. The goal is to have the user click on the link on their mobile browser and initialize download. However, right now, when the link is clicked, I see a new tab, which disappears immediately and no download starts.

<a href="url_to_apk" target="_blank">
  Download APK
</a>

Based on my investigation, this issue only shows up in Chrome v0.59 and above. When I downgraded my android chrome app to v0.58, the download works just fine.

I have also tested the site on Firefox, and everything downloads fine.

I also tried to use different target attributes, adding download attribute to <a>, but nothing seems to work.

The only way to download properly is to long press on the link, then click download link from the popup menu. This seems like how google suggests to download file. see here

However, if I go to another apk download site, like apkpure.com, I can download the apk in the browser without any issues.

Anyone has an idea why this is happening?

like image 676
davidhu Avatar asked Sep 06 '17 00:09

davidhu


1 Answers

I just had the same problem. The solution that worked for me was to remove the target attribute. I can't explain why but I suppose it's for security purposes.

Before:

<a href="url_to_apk" target="_blank">
  Download APK
</a>

After:

<a href="url_to_apk">
  Download APK
</a>
like image 66
LeKangouroo Avatar answered Oct 20 '22 01:10

LeKangouroo