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
SecurityPolicyViolationEvent
object.
Properties
SecurityPolicyViolationEvent.blockedURI
Read only- The URI of the resource blocked because it violates a policy.
SecurityPolicyViolationEvent.disposition
Read only- Indicates how the violated policy is configured to be treated by the user agent. This will be
"enforce"
or"report"
. SecurityPolicyViolationEvent.documentURI
Read only- The URI of the document or worker in which the violation was found.
SecurityPolicyViolationEvent.effectiveDirective
Read only- The string representing the directive whose enforcement uncovered the violation.
SecurityPolicyViolationEvent.LineNumber
Read only- The line number in the document or worker at which the violation occurred.
SecurityPolicyViolationEvent.originalPolicy
Read only- A string containing the policy whose enforcement uncovered the violation.
SecurityPolicyViolationEvent.referrer
Read only- The referrer of the resources whose policy was violated. This will be a URL or null.
SecurityPolicyViolationEvent.sourceFile
Read only- The URI of the document or worker in which the violation was found.
SecurityPolicyViolationEvent.statusCode
Read only- The HTTP status code of the document or worker in which the violation occurred.
SecurityPolicyViolationEvent.violatedDirective
Read 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 |