首页 > 编程知识 正文

h5怎么下载文件到手机上,h5下载文件不弹弹窗

时间:2023-05-06 20:01:33 阅读:130058 作者:4484

! doctypehtmlhtmllang=' en ' headmetacharset=' utf-8 ' title文件下载/title/headbody! -已导航到文件路径--a href='http://www.baidu.com '百度/aa href='./hyper-setup-2.0.0.exe '命令dream.txt'download下载图片/abutton id='btn '下载/buttonscript //防止他人抓取页面的资源。 脚本中let BTN=document.query selector (' # BTN ' ); 控制台. log (BTN; BTN.onclick=function ((const link=document.createelement ) ' a ); link.href='txt.txt '; link.download='文件1.txt '; 下载链接. click (; //点击时下载(展开//conststr '回忆的浪漫'; downloadfile('dream.doc ',str,' application/msword ' ); downloadfile('dream.txt ',str,' text/plain ' ); 功能下载文件(filename,content,type ) constblob=newblob([content],{type:type} ); 获取blob对象const URL=window.URL.createobject URL (blob )//urlconstlink=document.createeelement (' a ); link.href=url; link.download=filename; //下载的文件名link.click (; }/script/body/html

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。