这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
statusCode
只读特性在
SecurityPolicyViolationEvent
interface is a number representing the HTTP status code of the document or worker in which the violation occurred.
let status = violationEventInstance.statusCode;
A number representing the status code of the document or worker in which the violation occurred.
document.addEventListener("securitypolicyviolation", (e) => {
console.log(e.statusCode);
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
Content Security Policy Level 3
The definition of 'statusCode' in that specification. |
工作草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
statusCode
|
Chrome Yes | Edge 15 |
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 |
完整支持
不支持
用户必须明确启用此特征。