This is an archived page. It's not actively maintained.

Warning: Removed in Firefox 65.

The download() method of the HTMLIFrameElement interface downloads a specified URL, storing it at /sdcard/download.


var instanceOfDOMRequest =, options);


A DOMRequest for handling the download request. Its request.onsuccess handler handles the success case, and its request.onerror handler handles the failure case.


The URL of the file to be downloaded.
options Optional
An options object allowing optional settings to be specified for the download. The available options are:
  • filename: The filename to save the downloaded file as. If this is not specified, the filename used will be the original filename, as specified in the url.
  • referrer: Specifies a referrer for the downloaded file. If this is not specified there will be no referrer.


var browser = document.querySelector('iframe');

var request =, { filename: 'foo.bin' });

request.onsuccess = function() {
  console.log("File downladed");

request.onerror = function() {
  console.log("Download error");


Not part of any specification.

Browser compatibility

Supported since Firefox 47, in chrome code only. Removed completely in Firefox 65.

Unlikely ever to be supported in other browsers.

See also