Skip to content

Commit

Permalink
Add a check for Content Security Policy (CSP).
Browse files Browse the repository at this point in the history
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.

[1]: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html
  • Loading branch information
mikewest committed Aug 11, 2012
1 parent 362bceb commit 16e282b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 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: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html

Modernizr.addTest('contentsecuritypolicy', 'SecurityPolicy' in document);

0 comments on commit 16e282b

Please sign in to comment.