下载的几种方式
打开下载链接的方式
-
html方式(a标签)
<a href="https://whereyourfilepathto.com/xxx.zip" target="_blank"></a> 复制代码
行为:打开一个新的窗口并触发浏览器的下载行为
-
js方式
-
window.open
window.open('https://whereyourfilepathto.com/xxx.zip'); 复制代码
行为:打开一个新的窗口并触发浏览器的下载行为
-
window.location.assign
window.location.assign('https://whereyourfilepathto.com/xxx.zip'); 复制代码
行为:不打开新的窗口并触发浏览器的下载行为
推荐这种
-
:D 喜欢就点个?吧