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ệ
InvalidStateErrorDOMException-
Được ném ra nếu
Documenthiện tại chưa hoạt động. NotAllowedErrorDOMException-
Được ném ra nếu
Documenthiện tại không được tải trong secure context. TypeErrorDOMException-
Được ném ra nếu
issuerkhô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> |