[英]Download File Link for In App Browser
A mobile app having an In App browser links to website to download files. 具有应用程序内浏览器的移动应用程序链接到网站以下载文件。
I added the download attribute to force download 我添加了download属性以强制下载
<a android:linksClickable="true" href="'.$url.'/used/'.$productcode.'" target="_blank" alt="Order" title="Order #'.$orderid.'" download>Download Key</a>
It's working on desktops allowing you to download the file however when clicking the link in the mobile app it does nothing. 它在台式机上运行,允许您下载文件,但是在移动应用程序中单击链接时,它什么也没做。
I also added the javascript in header maybe it resolve the issue but it is still not working 我还在标头中添加了javascript,也许它可以解决问题,但仍然无法正常工作
<script type="text/javascript">
function externalLinks() {
var links = document.querySelectorAll("a"),
i = 0,
len = links.length;
for (; i < len; i++) {
(function(link, j) {
if (link.href) {
link.target = "_blank";
alert("index = " + j);
link.addEventListener("click", function() {
alert(j);
}, false);
}
}(links[i], i));
}
}
</script>
In our XML file for the link you can add 在链接的XML文件中,您可以添加
android:autoLink="web"
and the link should be clickable and work. 并且链接应该是可点击的并且有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.