草案
此页面不完整。
只读
类型
特性为
ClipboardItem
interface returns an
数组
of
MIME 类型
available within the
ClipboardItem
var types = clipboardItem.types;
In the below example, we're returning all items on the clipboard via the
clipboard.read()
method. Then checking the
类型
property for available types before utilizing the
ClipboardItem.getType()
method to return the
Blob
object. If no clipboards contents is found for the specified type, an error is returned.
async function getClipboardContents() {
try {
const clipboardItems = await navigator.clipboard.read();
for (const clipboardItem of clipboardItems) {
for (const type of clipboardItem.types) {
const blob = await clipboardItem.getType(type);
// we can now use blob here
}
}
} catch (err) {
console.error(err.name, err.message);
}
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
Clipboard API and events
The definition of 'ClipboardItem' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
类型
|
Chrome 66 | Edge ≤79 | Firefox No | IE No | Opera Yes | Safari No | WebView Android 66 | Chrome Android 66 | Firefox Android No | Opera Android Yes | Safari iOS No | Samsung Internet Android Yes |
完整支持
不支持
实验。期望将来行为有所改变。