SecurityPolicyViolationEvent: SecurityPolicyViolationEvent() constructor
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
. options
Optional-
An object that, in addition of the properties defined in
Event()
, can have the following properties:blockedURI
Optional-
The
blockedURI
of theSecurityPolicyViolationEvent
. If not included, the default value is""
. columnNumber
Optional-
The
columnNumber
of theSecurityPolicyViolationEvent
. If not included, the default value is0
. disposition
-
The
disposition
of theSecurityPolicyViolationEvent
. documentURI
-
The
documentURI
of theSecurityPolicyViolationEvent
. effectiveDirective
-
The
effectiveDirective
of theSecurityPolicyViolationEvent
. lineNumber
Optional-
The
lineNumber
of theSecurityPolicyViolationEvent
. If not included, the default value is0
. originalPolicy
-
The
originalPolicy
of theSecurityPolicyViolationEvent
. referrer
Optional-
The
referrer
of theSecurityPolicyViolationEvent
. If not included, the default value is""
. sample
Optional-
The
sample
of theSecurityPolicyViolationEvent
. If not included, the default value is""
. sourceFile
Optional-
The
sourceFile
of theSecurityPolicyViolationEvent
. If not included, the default value is""
. statusCode
-
The
statusCode
of theSecurityPolicyViolationEvent
. violatedDirective
-
The
violatedDirective
of theSecurityPolicyViolationEvent
.
Return value
A new SecurityPolicyViolationEvent
object.
Examples
let SPVEvt = new SecurityPolicyViolationEvent("foo", {
/* ... */
});
Specifications
Specification |
---|
Content Security Policy Level 3 # dom-securitypolicyviolationevent-securitypolicyviolationevent |
Browser compatibility
BCD tables only load in the browser