Content-Disposition Header

Table of Content

The Content-Disposition response header is an HTTP header field used to convey additional information about how to process the response payload, often indicating whether the content should be displayed inline in the browser, that it needs to be downloaded and saved locally, or simply providing a filename for download. It helps the server instruct the browser how to process different types of documents.


The syntax and structure take the form of Content-Disposition: inline or Content-Disposition: attachment, sometimes followed by a filesystem-safe filename in order to save the file.

Content-Disposition: inline
Content-Disposition: attachment
Content-Disposition: attachment; filename="filename.jpg"


The directives for the Content-Disposition header primarily include inline, attachment, and filename.

  • inline: Specifies that the browser should display the content in the user's browser window.
  • attachment: Specifies that the browser should prompt the user to save the content to disk.
  • filename: If this directive is specified, the browser will save the file with the suggested filename, but without removing any dangerous customer-provided content.


Content-Disposition: attachment; filename="cool_pic.jpg"

In this example, when the browser processes this header it prompts the user to download the file cool_pic.jpg.

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Supported
Safari Supported
Opera Supported
Edge Supported

How to modify Content-Disposition header

ModHeader is a Chrome extension that allows you to change headers on requests and responses. By using ModHeader, users can modify the Content-Disposition header when making HTTP requests. Here is a step-by-step guide:

  1. Install the ModHeader extension from the Chrome Web Store.
  2. Open the developer tools panel. (Navigate to View > Developer > Developer Tools)
  3. Click on the ModHeader tab.
  4. In the Response Headers section, click Add.
  5. In the Name field, enter Content-Disposition.
  6. In the Value field, enter the desired value (e.g., attachment).

This will modify all requests to include the new Content-Disposition header, which can be particularly useful when testing how your application handles different types of content-disposition scenarios.