这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
SecurityPolicyViolationEvent
构造函数创建新
SecurityPolicyViolationEvent
对象实例。
let SPVEvt = new SecurityPolicyViolationEvent(type, eventInitDict);
DOMString
representing the type of security policy violation that occurred.
SecurityPolicyViolationEvent
to be constructed. This can include the following properties, but bear in mind that if you do include an
eventInitDict
, certain properties must be included (marked below with
required
):
blockedURI
:
blockedURI
的
SecurityPolicyViolationEvent
. If not included, the default value is
""
.
columnNumber
:
columnNumber
的
SecurityPolicyViolationEvent
. If not included, the default value is
0
.
disposition
:
disposition
的
SecurityPolicyViolationEvent
(
required
).
documentURI
:
documentURI
的
SecurityPolicyViolationEvent
(
required
).
effectiveDirective
:
effectiveDirective
的
SecurityPolicyViolationEvent
(
required
).
lineNumber
:
lineNumber
的
SecurityPolicyViolationEvent
. If not included, the default value is
0
.
originalPolicy
:
originalPolicy
的
SecurityPolicyViolationEvent
(
required
).
referrer
:
referrer
的
SecurityPolicyViolationEvent
. If not included, the default value is
""
.
sample
:
sample
的
SecurityPolicyViolationEvent
. If not included, the default value is
""
.
sourceFile
:
sourceFile
的
SecurityPolicyViolationEvent
. If not included, the default value is
""
.
statusCode
:
statusCode
的
SecurityPolicyViolationEvent
(
required
).
violatedDirective
:
violatedDirective
的
SecurityPolicyViolationEvent
(
required
).
A
SecurityPolicyViolationEvent
对象实例。
let SPVEvt = new SecurityPolicyViolationEvent('foo', {
...
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
Content Security Policy Level 3
The definition of 'SecurityPolicyViolationEvent' in that specification. |
工作草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
SecurityPolicyViolationEvent()
构造函数
|
Chrome Yes | Edge ≤18 |
Firefox
63
|
IE 不支持 No | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes |
Firefox Android
63
|
Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
完整支持
不支持
用户必须明确启用此特征。
SecurityPolicyViolationEvent
SecurityPolicyViolationEvent()