0
votes

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?

1

1 Answers

0
votes

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.