Search code examples
google-chrome-extensionfirefox-addon-webextensions

For a web extension, what is the very minimum permission required to provide a file to a user?


To implement a new feature in a FF & Chrome web extension and let the user download some data gathered and stored into local storage, I am using chrome.downloads.download(). It requires the "downloads" permission, which has a label stating that it gives access to the download history. As I'm willing not to frighten users with suspicious permissions, I wonder if there is another way of providing this data without requesting "downloads" permission.

My current code looks like:

chrome.downloads.download({
    filename: "myfile.json",
    saveAs: true,
    url: URL.createObjectURL(blob)
});```

Solution

  • After searching for a while, I think the best approach is to use the optional permissions feature. It allows me to request this downloads permission at runtime, then the user is aware of the context in which it is needed. See https://extensionworkshop.com/documentation/develop/request-the-right-permissions/#request-permissions-at-runtime