StorageAccessHandle: phương thức createObjectURL()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Note: Xem createObjectURL() để hiểu cách sử dụng.

Cú pháp

js
createObjectURL(object)

Tham số

object

Xem createObjectURL().

Giá trị trả về

Một chuỗi chứa URL đối tượng không phân vùng có thể được sử dụng để tham chiếu đến nội dung của object nguồn được chỉ định.

Ngoại lệ

SecurityError DomException

Được ném ra nếu quyền truy cập không được cấp.

Xem createObjectURL()

Ví dụ

js
document.requestStorageAccess({ createObjectURL: true }).then(
  (handle) => {
    console.log("createObjectURL access granted");
    handle.createObjectURL(new Blob(["foo"]));
  },
  () => {
    console.log("createObjectURL access denied");
  },
);

Note: Xem Using the Storage Access API để biết ví dụ đầy đủ hơn.

Thông số kỹ thuật

Specification
Extending Storage Access API (SAA) to non-cookie storage
# dom-storageaccesshandle-createobjecturl

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

Xem thêm