This is crazy but I don't know how to do this, and because of how common the words are, it's hard to find what I need on search engines.
(这太疯狂了,但是我不知道该怎么做,而且由于这些单词很常见,因此很难在搜索引擎上找到我需要的东西。)
I'm thinking this should be an easy one to answer. (我认为这应该很容易回答。)
I want a simple file download, that would do the same as this:
(我想要一个简单的文件下载,该操作与此相同:)
<a href="file.doc">Download!</a>
But I want to use an HTML button, eg either of these:
(但是我想使用HTML按钮,例如以下任一按钮:)
<input type="button" value="Download!">
<button>Download!</button>
Likewise, is it possible to trigger a simple download via JavaScript?
(同样,是否可以通过JavaScript触发简单下载?)
$("#fileRequest").click(function(){ /* code to download? */ });
I'm definitely not looking for a way to create an anchor that looks like a button, use any back-end scripts, or mess with server headers or mime types.
(我绝对不是在寻找一种创建类似于按钮的锚,使用任何后端脚本或与服务器标头或mime类型混淆的方法。)
ask by brentonstrine translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…