简体   繁体   English

下载应用程序内浏览器的文件链接

[英]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.

相关问题 如何制作链接以在浏览器上下载服务器文件? - How to make a link to download a server file on the browser? 如何通过单击链接在 Angular Front End Web App 的浏览器中下载或保存 .csv 文件? 浏览器投诉没有文件 - How can I download or save a .csv file in browser in Angular Front End Web App on click of a link? browser complaints no file 链接/按钮从子文件夹浏览器下载文件只是浏览 - Link/button to download file from subfolder— browser just browses 在同一页面中将 PDF 链接下载为文件,而不是在浏览器中打开 - Download a PDF link as a file in the same page instead of opening in browser 在 html 锚链接上下载音频文件,单击独立于浏览器操作 - Download audio file on html anchor link click independant of browser action xpages中的Lotus Notes客户端链接和浏览器链接以下载存储在服务器目录中的文件 - Lotus notes client link and browser link in xpages to download file stored in server directory 单击时如何在新的浏览器选项卡中打开下载链接并在文件下载链接出现之前在该选项卡上设置倒计时 - How do I make a download link open in a new browser tab when clicked and set a countdown on that tab before the file download link appears 在浏览器中下载文件 - Download a file in the browser HTML通过链接下载文件 - HTML download the file by link 创建一个链接来下载文件 - create a link to download the file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM