docs.rodeo

MDN Web Docs mirror

CSP: sandbox

{{HTTPSidebar}} 

The HTTP {{HTTPHeader("Content-Security-Policy")}}  (CSP) sandbox directive enables a sandbox for the requested resource similar to the {{HTMLElement("iframe")}}  sandbox attribute. It applies restrictions to a page’s actions including preventing popups, preventing the execution of plugins and scripts, and enforcing a same-origin policy.

CSP version 1.1 / 2
Directive type `{{Glossary("Document directive")}}` 
This directive is not supported in the `{{HTMLElement("meta")}}`  element or by the `{{HTTPHeader("Content-Security-policy-Report-Only")}}`  header field.

Syntax

Content-Security-Policy: sandbox;
Content-Security-Policy: sandbox <value>;

where <value> can optionally be one of the following values:

[!NOTE] The allow-top-navigation and related values only make sense for embedded documents (such as child iframes). For standalone documents, these values have no effect, as the top-level browsing context is the document itself.

Examples

Content-Security-Policy: sandbox allow-scripts;

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN