SecurityPolicyViolationEvent

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。

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.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

文档标签和贡献者