Reporting API
The SecurityPolicyViolationEvent() constructor creates a new SecurityPolicyViolationEvent object.
Syntax
new SecurityPolicyViolationEvent(type)
new SecurityPolicyViolationEvent(type, options)
Parameters
type- : A string with the name of the event.
It is case-sensitive and browsers always set it to
securitypolicyviolation.
- : A string with the name of the event.
It is case-sensitive and browsers always set it to
options- : An object that, in addition of the properties defined in Event/Event, can have the following properties:
blockedURI- : The SecurityPolicyViolationEvent.blockedURI of the
SecurityPolicyViolationEvent. If not included, the default value is"".
- : The SecurityPolicyViolationEvent.blockedURI of the
columnNumber- : The SecurityPolicyViolationEvent.columnNumber of the
SecurityPolicyViolationEvent. If not included, the default value is0.
- : The SecurityPolicyViolationEvent.columnNumber of the
disposition- : The SecurityPolicyViolationEvent.disposition of the
SecurityPolicyViolationEvent.
- : The SecurityPolicyViolationEvent.disposition of the
documentURI- : The SecurityPolicyViolationEvent.documentURI of the
SecurityPolicyViolationEvent.
- : The SecurityPolicyViolationEvent.documentURI of the
effectiveDirective- : The SecurityPolicyViolationEvent.effectiveDirective of the
SecurityPolicyViolationEvent.
- : The SecurityPolicyViolationEvent.effectiveDirective of the
lineNumber- : The SecurityPolicyViolationEvent.lineNumber of the
SecurityPolicyViolationEvent. If not included, the default value is0.
- : The SecurityPolicyViolationEvent.lineNumber of the
originalPolicy- : The SecurityPolicyViolationEvent.originalPolicy of the
SecurityPolicyViolationEvent.
- : The SecurityPolicyViolationEvent.originalPolicy of the
referrer- : The SecurityPolicyViolationEvent.referrer of the
SecurityPolicyViolationEvent. If not included, the default value is"".
- : The SecurityPolicyViolationEvent.referrer of the
sample- : The SecurityPolicyViolationEvent.sample of the
SecurityPolicyViolationEvent. If not included, the default value is"".
- : The SecurityPolicyViolationEvent.sample of the
sourceFile- : The SecurityPolicyViolationEvent.sourceFile of the
SecurityPolicyViolationEvent. If not included, the default value is"".
- : The SecurityPolicyViolationEvent.sourceFile of the
statusCode- : The SecurityPolicyViolationEvent.statusCode of the
SecurityPolicyViolationEvent.
- : The SecurityPolicyViolationEvent.statusCode of the
violatedDirective- : The SecurityPolicyViolationEvent.violatedDirective of the
SecurityPolicyViolationEvent.
- : The SecurityPolicyViolationEvent.violatedDirective of the
- : An object that, in addition of the properties defined in Event/Event, can have the following properties:
Return value
A new SecurityPolicyViolationEvent object.
Examples
let SPVEvt = new SecurityPolicyViolationEvent("foo", {/* ... */});
Specifications
Browser compatibility
See also
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
