使用 JavaScript/jQuery 下载文件 [英] Download File Using JavaScript/jQuery

查看:38
本文介绍了使用 JavaScript/jQuery 下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此处指定了一个非常相似的要求.

I have a very similar requirement specified here.

$('a#someID').click();

但我不能使用 window.href 方法,因为它用您尝试下载的文件替换当前页面内容.

But I cannot use the window.href method, since it replaces the current page contents with the file you're trying to download.

相反,我想在新窗口/选项卡中打开下载.这怎么可能?

Instead I want to open the download in new window/tab. How is this possible?

推荐答案

使用不可见的