ClipboardChangeEvent: types property

Limited availability

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

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The types read-only property of the ClipboardChangeEvent interface returns an array of strings representing the mandatory MIME types available on the system clipboard when the ClipboardChangeEvent event was fired. Optional types and custom formats are not included to limit 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

Specification
Clipboard API and events
# dom-clipboardchangeevent-types

Browser compatibility

See also