DevKits

Content · Response header

Content-Disposition

Controls whether a resource is displayed inline or triggered as a download.

What is Content-Disposition?

Content-Disposition tells the browser how to present the resource. `inline` (default) tries to render it in the page; `attachment` forces a download prompt with the given filename.

Typical usage

Set on responses that should be downloaded rather than opened in the browser.

Examples

Force download

Content-Disposition: attachment; filename="report.pdf"

Multi-byte filename

Content-Disposition: attachment; filename*=UTF-8''%E6%8A%A5%E5%91%8A.pdf

Common gotchas

For non-ASCII filenames, use `filename*` with UTF-8 percent-encoding (RFC 5987). Legacy `filename=` may be mojibake in older browsers.

Specification

RFC 6266

Related headers