SecurityPolicyViolationEvent: SecurityPolicyViolationEvent() constructor
        
        
          
                Baseline
                
                  Widely available
                
                
              
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2018.
Note: This feature is available in Web Workers.
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. optionsOptional- 
An object that, in addition of the properties defined in
Event(), can have the following properties:blockedURIOptional- 
The
blockedURIof theSecurityPolicyViolationEvent. If not included, the default value is"". columnNumberOptional- 
The
columnNumberof theSecurityPolicyViolationEvent. If not included, the default value is0. disposition- 
The
dispositionof theSecurityPolicyViolationEvent. documentURI- 
The
documentURIof theSecurityPolicyViolationEvent. effectiveDirective- 
The
effectiveDirectiveof theSecurityPolicyViolationEvent. lineNumberOptional- 
The
lineNumberof theSecurityPolicyViolationEvent. If not included, the default value is0. originalPolicy- 
The
originalPolicyof theSecurityPolicyViolationEvent. referrerOptional- 
The
referrerof theSecurityPolicyViolationEvent. If not included, the default value is"". sampleOptional- 
The
sampleof theSecurityPolicyViolationEvent. If not included, the default value is"". sourceFileOptional- 
The
sourceFileof theSecurityPolicyViolationEvent. If not included, the default value is"". statusCode- 
The
statusCodeof theSecurityPolicyViolationEvent. violatedDirective- 
The
violatedDirectiveof 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
Loading…