The open() function of the downloads API opens the downloaded file with its associated application.

A downloads.onChanged event will fire when the item is opened for the first time.

Note: To use this function in your WebExtension you must ask for the "" manifest permission, as well as the "downloads" permission.

  downloadId,      // integer
  function() {...} // optional function

This API is also available as in a version that returns a promise.


An integer representing the id of the downloads.DownloadItem you want to open.
function() {}Optional
An optional callback function that gets invoked, with no parameters, when the open() call has completed.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes No 48.0 48.0 33


The following snippet shows two buttons, "download" and "open". The first button when clicked initiates a download using Once the download has started, the second button can be pressed to open the file with its associated application.

var downloadBtn = document.querySelector('.download');
var openBtn = document.querySelector('.open');

downloadBtn.onclick = function() {{ url : ''},

  function callback(downloadId) {
    if(chrome.runtime.lastError) {
    } else {
      openBtn.onclick = function() {, function() {
          console.log('File opened');

Example add-ons


This API is based on Chromium's chrome.downloads API.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: Makyen, wbamberg, chrisdavidmills
 Last updated by: Makyen,