← Back to Browser domain

Browser.setDownloadBehavior

Set the behavior when downloading a file.

Domain: Browser experimental

Parameters

NameTypeDescription
behaviorstringWhether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). |allowAndName| allows download and names files according to their download guids.
browserContextId (optional)BrowserContextIDBrowserContext to set download behavior. When omitted, default browser context is used.
downloadPath (optional)stringThe default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'.
eventsEnabled (optional)booleanWhether to emit download events (defaults to false).

Example Request

{
  "id": 1,
  "method": "Browser.setDownloadBehavior",
  "params": {
    "behavior": "behavior-value"
  }
}

Example Response

{
  "id": 1,
  "result": {}
}

Usage in Node.js

const result = await send('Browser.setDownloadBehavior', {"behavior": "behavior-value"});
console.log(result);