SecurityPolicyViolationEvent: statusCode property

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.

Thuộc tính chỉ đọc statusCode của giao diện SecurityPolicyViolationEvent là một số biểu diễn mã trạng thái HTTP của cửa sổ hoặc worker mà tại đó vi phạm Chính sách bảo mật nội dung (CSP) xảy ra.

Giá trị

Một số biểu diễn mã trạng thái của cửa sổ hoặc worker mà tại đó vi phạm xảy ra.

Ví dụ

js
document.addEventListener("securitypolicyviolation", (e) => {
  console.log(e.statusCode);
});

Thông số kỹ thuật

Thông số kỹ thuật
Content Security Policy Level 3
# dom-securitypolicyviolationevent-statuscode

Tương thích trình duyệt

Xem thêm