简体   繁体   English

如何在不打开新标签的情况下在Google Chrome扩展程序中下载文件

[英]How to download file in google chrome extension without opening a new tab

I'm currently developing a Google Chrome extension and I need to be able to initiate a file download from the popup. 我目前正在开发Google Chrome扩展程序,我需要能够从弹出窗口启动文件下载。 The idea is that the user clicks a link and the download starts. 想法是用户单击链接并开始下载。 I can do this by creating a new tab and setting the url to the download link, but I would like to avoid opening a new tab, or at least opening it and closing it as soon as the download begins. 我可以通过创建一个新选项卡并将URL设置为下载链接来实现此目的,但我希望避免打开一个新选项卡,或者至少打开它并在下载开始后立即关闭它。

Is it possible to do what I want? 有可能做我想要的吗? How? 怎么样? Is it possible to do it programmatically, from the event page? 是否可以从事件页面以编程方式执行此操作?

Thanks for any help. 谢谢你的帮助。

此问题包含有关使用iFrame使浏览器下载文件的一些有价值的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM