Document: phương thức hasRedemptionRecord()

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Phương thức hasRedemptionRecord() của giao diện Document trả về một promise sẽ được phân giải với một giá trị boolean cho biết trình duyệt có redemption record bắt nguồn từ một nhà phát hành cụ thể hay không.

Cú pháp

js
hasRedemptionRecord(issuer)

Tham số

issuer

Một chuỗi đại diện cho URL của máy chủ phát hành.

Giá trị trả về

Một Promise phân giải với một giá trị boolean cho biết trình duyệt có lưu trữ redemption record bắt nguồn từ máy chủ phát hành đã chỉ định hay không.

Ngoại lệ

InvalidStateError DOMException

Được ném ra nếu Document hiện tại chưa hoạt động.

NotAllowedError DOMException

Được ném ra nếu Document hiện tại không được tải trong secure context.

TypeError DOMException

Được ném ra nếu issuer không phải là URL hợp lệ.

Ví dụ

js
const hasRR = await Document.hasRedemptionRecord(`issuer.example`);
if (hasRR) {
  await fetch("some-resource.example", {
    method: "POST",
    privateToken: {
      version: 1,
      operation: "send-redemption-record",
      issuers: ["https://issuer.example"],
    },
  });
}

Đặc tả kỹ thuật

Specification
Private State Token API
# dom-document-hasredemptionrecord

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

Xem thêm