SecurityPolicyViolationEvent: effectiveDirective 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 effectiveDirective của giao diện SecurityPolicyViolationEvent là một chuỗi biểu diễn chỉ thị Chính sách bảo mật nội dung (CSP) bị vi phạm.

Thuộc tính này thay thế SecurityPolicyViolationEvent.violatedDirective, bí danh lịch sử của nó.

Giá trị

Một chuỗi biểu diễn chỉ thị Content-Security-Policy cụ thể bị vi phạm.

Ví dụ

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

Thông số kỹ thuật

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

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

Xem thêm