Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a check for Content Security Policy (CSP).

The current editor's draft of the Content Security Policy 1.1 spec defines an
experimental feature detection API[1]. The feature is implemented in WebKit
behind a flag. Currently, only Chrome 22+ has that flag enabled by
default, but let's hope that changes going forward.

  • Loading branch information...
commit 16e282b296cfc17510c5d41a34df73ca1ba0fd3f 1 parent 362bceb
@mikewest authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 feature-detects/contentsecuritypolicy.js
10 feature-detects/contentsecuritypolicy.js
@@ -0,0 +1,10 @@
+// Test for (experimental) Content Security Policy 1.1 support.
+// This feature is still quite experimental, but is available now in Chrome 22.
+// If the `SecurityPolicy` property is available, you can be sure the browser
+// supports CSP. If it's not available, the browser still might support an
+// earlier version of the CSP spec.
+// Editor's Draft:
+Modernizr.addTest('contentsecuritypolicy', 'SecurityPolicy' in document);
Please sign in to comment.
Something went wrong with that request. Please try again.