Clipboard API
The read-only presentationStyle property of the ClipboardItem interface returns a string indicating how an item should be presented.
For example, in some contexts an image might be displayed inline, while in others it might be represented as an attachment.
Value
One of either "unspecified", "inline" or "attachment".
Examples
In the below example, we're returning all items on the clipboard via the clipboard.read() method, then logging the presentationStyle property.
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);
}
}
Specifications
Browser compatibility
See also
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
