ClipboardChangeEvent: types property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{securecontext_header}}{{APIRef("Clipboard API")}}{{SeeCompatTable}}

The **types** read-only property of the {{domxref("ClipboardChangeEvent")}} interface returns an array of strings representing the mandatory {{glossary("MIME type","MIME types")}} available on the system clipboard when the ClipboardChangeEvent event was fired. Optional types and custom formats are not included to limit {{glossary("fingerprinting")}}.

Value

An array of strings.

Examples

In this example, when the contents of the clipboard change, the event listener logs to the console every string representing a mime type that is available in the array returned by the ClipboardChangeEvent.types property.

js
navigator.clipboard.addEventListener("clipboardchange", (event) => {
  event.types.forEach((value) => {
    console.log(value);
  });
});

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("ClipboardChangeEvent.changeId")}}
  • {{domxref("ClipboardChangeEvent")}}
  • {{domxref("ClipboardEvent")}}
  • Clipboard API