开发者

Firefox extension: open download link in download window

开发者 https://www.devze.com 2023-03-06 07:07 出处:网络
I have an extension which opens links via context menu just like built-in Open link in new tab Firefox menu (just below it; My context menu item is Download link).

I have an extension which opens links via context menu just like built-in Open link in new tab Firefox menu (just below it; My context menu item is Download link).

When a user select this option from link context menu a new tab is opened by开发者_如何转开发 Firefox and then the download is started in download manager window. After a while, this will end-up many blank tabs opened when the user right click on links and use my extension (he should close them manually).

I have tried Javascript command window.open but it will open a new window which is worse than opening a new tab!

How can I prevent opening a new tab each time and start the download directly in Firefox download manager window ?

OR

How can I close that tab/window when the page content is a download?


You can leverage the nsIDownloadManger interface to directly add downloads to the download manager. To automatically start downloading after you also need a nsIWebBrowserPersist object.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号