SudoPlz
SudoPlz

Reputation: 23233

How can I download a file in Firefox Webextension without using chrome.downloads.download?

in my chrome extension I use chrome.downloads.download to initiate a file download, but in firefox Web Extensions this method is not yet implemented (as seen here).

Is there any other way I can initiate a file download from within my firefox add-on?

Thank you

Upvotes: 2

Views: 1094

Answers (1)

SudoPlz
SudoPlz

Reputation: 23233

Nevermind I used html5's download attribute.

I create < a>'s using:

var a = document.createElement("a");

and then add the download property like so:

a.download = rowData.url+".mp4";

Clicking the a link within my web extension firefox add-on now downloads the file instead of opening it within its view.

Upvotes: 3

Related Questions