X-download-options - Header [top]
: Instructs the browser to hide the "Open" button in the download dialog. Syntax Example: X-Download-Options: noopen Use code with caution. Why Use It Today?
: Selecting "Open" allows the browser to render the file directly. If that file contains malicious scripts, it could execute them with access to the site's cookies, session data, and other sensitive information, effectively bypassing the Same-Origin Policy. x-download-options header
: The X-Download-Options header removes the "Open" option from the download dialog. This forces the user to save the file to their local machine before opening it. Once saved, the file runs in a local context rather than the domain context, preventing it from accessing the originating site's data. Directives This header supports only one valid directive: : Instructs the browser to hide the "Open"
The primary goal of this header is to prevent the browser from automatically executing potentially malicious code within the context of a website's domain. : Selecting "Open" allows the browser to render
: Providing an extra layer of security alongside other headers like X-Frame-Options and Strict-Transport-Security .
Most modern web frameworks and security middlewares include this header by default. For example: helmetjs/helmet: Help secure Express apps with ... - GitHub