Content-Security-Policy
Parameters
<meta http-equiv="Content-Security-Policy" content="default-src"><meta http-equiv="Content-Security-Policy" content="script-src"><meta http-equiv="Content-Security-Policy" content="style-src"><meta http-equiv="Content-Security-Policy" content="img-src"><meta http-equiv="Content-Security-Policy" content="connect-src"><meta http-equiv="Content-Security-Policy" content="font-src"><meta http-equiv="Content-Security-Policy" content="object-src"><meta http-equiv="Content-Security-Policy" content="media-src"><meta http-equiv="Content-Security-Policy" content="frame-src">Code examples
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; object-src 'none'; base-uri 'self';"><meta http-equiv="Content-Security-Policy" content="script-src 'nonce-r4nd0m-per-response';"><meta http-equiv="Content-Security-Policy" content="default-src *;"><meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-inline';">Recommendations
- 01Prefer an HTTP Response HeaderThe response header supports the full CSP feature set and protects the document before any HTML is parsed. Use a meta policy only when you cannot set headers.
- 02Place Meta Policies FirstA meta policy protects only content that follows it. Put it as early in the head as possible.
- 03Know the Meta LimitsMeta delivery does not support report-only mode or the report-uri, frame-ancestors, and sandbox directives.
- 04Use a Fresh Nonce per ResponseWhen inline scripts are unavoidable, generate an unpredictable nonce for each response and apply it to the scripts you trust.
Related documentation
Related meta tags
Content-Security-Policy
http-equivEnforces a Content Security Policy from the document head. A policy limits where scripts, styles, images, connections, and other resources can come from, which reduces the impact of content injection bugs.
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; object-src 'none'; base-uri 'self';">content-type
http-equivProvides the legacy pragma form of an HTML character encoding declaration. For conforming HTML, its content must be text/html; charset=utf-8.
<meta http-equiv="content-type" content="text/html; charset=UTF-8">default-style
http-equivSelects the preferred CSS style sheet set by name when a page offers alternate titled stylesheets. Browser support is limited.
<meta http-equiv="default-style" content="Main Style">refresh
http-equivReloads the current page after a delay or performs a timed redirect. Automatic navigation can confuse users, so a server redirect is usually a better choice.
<meta http-equiv="refresh" content="5; URL=https://example.com/next">X-UA-Compatible
http-equivA legacy Internet Explorer pragma whose only conforming value is IE=edge. Current user agents must ignore it, so new pages should omit it.
<meta http-equiv="X-UA-Compatible" content="IE=edge">