setContentDisposition(type, filename) Last updated: 30. May 2026

API only function

Tells the browser to download and save the returned result to a file with the specified name.

Parameters

Name Type Description
type string

"attachment" or "inline", attachment value downloads a file and inline displays the file in the browser.

filename string

The filename to use for the downloaded or displayed result. If the content disposition header is set, the output buffer will be returned to the user as a file with this name.

Returns

null

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
docly.setContentDisposition("attachment", "Excel-file.xlsx");