ClipboardItem.presentationStyle

presentationStyleClipboardItem インターフェイスの読み取り専用プロパティで、アイテムをどう表示すべきかを示す文字列を返します。

"unspecified", "inline", "attachment" のいずれかです。

以下の例では、 clipboard.read() メソッドによってクリップボード上のすべての項目を返し、 presentationStyle プロパティをログ出力しています。

js
async function getClipboardContents() {
  try {
    const clipboardItems = await navigator.clipboard.read();

    for (const clipboardItem of clipboardItems) {
      console.log(clipboardItem.presentationStyle);
    }
  } catch (err) {
    console.error(err.name, err.message);
  }
}

仕様書

Specification
Clipboard API and events
# dom-clipboarditem-presentationstyle

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
presentationStyle

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

関連情報