Note: This feature is available in Web Workers.
The SecurityPolicyViolationEvent() constructor creates a new SecurityPolicyViolationEvent object.
new SecurityPolicyViolationEvent(type)
new SecurityPolicyViolationEvent(type, options)typeA string with the name of the event. It is case-sensitive and browsers always set it to securitypolicyviolation.
options OptionalAn object that, in addition of the properties defined in Event(), can have the following properties:
blockedURI OptionalThe blockedURI of the SecurityPolicyViolationEvent. If not included, the default value is "".
columnNumber OptionalThe columnNumber of the SecurityPolicyViolationEvent. If not included, the default value is 0.
dispositionThe disposition of the SecurityPolicyViolationEvent.
documentURIThe documentURI of the SecurityPolicyViolationEvent.
effectiveDirectiveThe effectiveDirective of the SecurityPolicyViolationEvent.
lineNumber OptionalThe lineNumber of the SecurityPolicyViolationEvent. If not included, the default value is 0.
originalPolicyThe originalPolicy of the SecurityPolicyViolationEvent.
referrer OptionalThe referrer of the SecurityPolicyViolationEvent. If not included, the default value is "".
sample OptionalThe sample of the SecurityPolicyViolationEvent. If not included, the default value is "".
sourceFile OptionalThe sourceFile of the SecurityPolicyViolationEvent. If not included, the default value is "".
statusCodeThe statusCode of the SecurityPolicyViolationEvent.
violatedDirectiveThe violatedDirective of the SecurityPolicyViolationEvent.
A new SecurityPolicyViolationEvent object.
let SPVEvt = new SecurityPolicyViolationEvent("foo", {/* ... */});