如何强制 chrome 下载文件而不打开它们? [英] How to force chrome to download files not opening them?
本文介绍了如何强制 chrome 下载文件而不打开它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 chrome tampermonkey 的用户脚本中使用 window.location.href="link.mp4" 但不是开始下载 chrome 打开文件并开始播放它.我在变量中有一个文件链接,如果有任何方法可以触发直通 idm,我也会使用 idm.
I am using window.location.href="link.mp4" in a userscript in chrome tampermonkey but rather than starting the download chrome is opening the file and starts playing it. I have a file link in a variable and i also use idm if there's any way to trigger the through idm.
推荐答案
您是否尝试过 下载 属性?
Did you try download attribute ?
示例单击链接时下载文件(而不是导航到文件):
Example Download file when clicking on the link (instead of navigating to the file):
http://www.w3schools.com/tags/att_a_download.asp
这篇关于如何强制 chrome 下载文件而不打开它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文