This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The SecurityPolicyViolationEvent interface is an event sent on a document or worker when its content security policy is violated.
Constructor
SecurityPolicyViolationEvent()- Creates a
SecurityPolicyViolationEventobject.
Properties
SecurityPolicyViolationEvent.blockedURIRead only- The URI of the resource blocked because it violates a policy.
SecurityPolicyViolationEvent.dispositionRead only- Indicates how the violated policy is configured to be treated by the user agent. This will be
"enforce"or"report". SecurityPolicyViolationEvent.documentURIRead only- The URI of the document or worker in which the violation was found.
SecurityPolicyViolationEvent.effectiveDirectiveRead only- The string representing the directive whose enforcement uncovered the violation.
SecurityPolicyViolationEvent.LineNumberRead only- The line number in the document or worker at which the violation occurred.
SecurityPolicyViolationEvent.originalPolicyRead only- A string containing the policy whose enforcement uncovered the violation.
SecurityPolicyViolationEvent.referrerRead only- The referrer of the resources whose policy was violated. This will be a URL or null.
SecurityPolicyViolationEvent.sourceFileRead only- The URI of the document or worker in which the violation was found.
SecurityPolicyViolationEvent.statusCodeRead only- The HTTP status code of the document or worker in which the violation occurred.
SecurityPolicyViolationEvent.violatedDirectiveRead only- The string representing the directive whose enforcement uncovered the violation.
Specifications
| Specification | Status | Comment |
|---|---|---|
| Content Security Policy Level 3 The definition of 'SecurityPolicyViolationEvent' in that specification. |
Editor's Draft | Initial definition. |
Browser Compatibility
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | ? | ? | (Yes) | ? |
| Worker support | 56.0 | 43 |
| Feature | Android Webview | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | ? | ? | ? | (Yes) | ? | (Yes) |
| Worker support | 56.0 | 43 | 56.0 |