W3cubDocs

/HTTP

Cross-Origin-Resource-Policy

Note: Due to a bug in Chrome, setting Cross-Origin-Resource-Policy can break PDF rendering, preventing visitors from being able to read past the first page of some PDFs. Due to a bug in Firefox, setting Cross-Origin-Resource-Policy can prevent some resources (such as PDFs) from being downloaded in some circumstances. Exercise caution using this header in a production environment.

The HTTP Cross-Origin-Resource-Policy response header conveys a desire that the browser blocks no-cors cross-origin/cross-site requests to the given resource.

Syntax

Cross-Origin-Resource-Policy: same-site | same-origin | cross-origin

Examples

The response header below will cause compatible user agents to disallow cross-origin no-cors requests:

Cross-Origin-Resource-Policy: same-origin

For more examples, see https://resourcepolicy.fyi/.

Specifications

Specification Status Comment
Fetch Living Standard Initial definition

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Cross-Origin-Resource-Policy 73
73
Until version 75, downloads for files with this header would fail in Chrome. See bug 952834.
From version 80, linearized PDFs served inline with this header fail to render properly. See bug 1074261.
79 74
74
69
Disabled
Disabled From version 69: this feature is behind the browser.tabs.remote.useCORP preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No 12
Mobile
Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
Cross-Origin-Resource-Policy 73
73
Until version 75, downloads for files with this header would fail in WebView. See bug 952834.
From version 80, linearized PDFs served inline with this header fail to render properly. See bug 1074261.
73
73
Until version 75, downloads for files with this header would fail in Chrome. See bug 952834.
From version 80, linearized PDFs served inline with this header fail to render properly. See bug 1074261.
No No 12 No

See also

© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy