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.
我有一个链接可以在我的网站上下载Android APK。目标是让用户单击其移动浏览器上的链接并初始化下载。但是,现在,当单击链接时,我会看到一个新选项卡,它会立即消失并且不会开始下载。
<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.
根据我的调查,此问题仅出现在Chrome v0.59及更高版本中。当我将我的Android Chrome应用程序降级到v0.58时,下载工作正常。
I have also tested the site on Firefox, and everything downloads fine.
我也在Firefox上测试了这个网站,一切都下载得很好。
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.
但是,如果我去另一个apk下载网站,比如apkpure.com,我可以在浏览器中下载apk而不会有任何问题。
Anyone has an idea why this is happening?
任何人都知道为什么会这样?
1 个解决方案
#1
1
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>
#1
1
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>