This API is experimental. It is only available to Chrome users on the dev channel.

chrome.clipboard

Description: The chrome.clipboard API is provided to allow users to access data of the clipboard. This is a temporary solution for chromeos platform apps until open-web alternative is available. It will be deprecated once open-web solution is available, which could be in 2017 Q4.
Availability: Dev channel only. Learn more.
Permissions: "clipboard"

Summary

Methods
setImageData chrome.clipboard.setImageData(ArrayBuffer imageData, enum of "png", or "jpeg" type, array of object additionalItems, function callback)
Events
onClipboardDataChanged

Methods

setImageData

chrome.clipboard.setImageData(ArrayBuffer imageData, enum of "png", or "jpeg" type, array of object additionalItems, function callback)

Dev channel only. Learn more.

Sets image data to clipboard.

Parameters
ArrayBuffer imageData

Since Chrome 64. Warning: this is the current Dev channel. Learn more.

The encoded image data.

enum of "png", or "jpeg" type

Since Chrome 64. Warning: this is the current Dev channel. Learn more.

The type of image being passed.

array of object (optional) additionalItems

Since Chrome 64. Warning: this is the current Dev channel. Learn more.

Additional data items for describing image data. The callback is called with chrome.runtime.lastError set to error code if there is an error. Requires clipboard and clipboardWrite permissions.

Properties of each object

enum of "textPlain", or "textHtml" type

Type of the additional data item.

string data

Content of the additional data item. Either the plain text string if |type| is "textPlain" or markup string if |type| is "textHtml". The data can not exceed 2MB.

function callback

The callback parameter should be a function that looks like this:

function() {...};

Events

onClipboardDataChanged

Dev channel only. Learn more.

Fired when clipboard data changes. Requires clipboard and clipboardRead permissions for adding listener to chrome.clipboard.onClipboardDataChanged event. After this event fires, the clipboard data is available by calling document.execCommand('paste').

addListener

chrome.clipboard.onClipboardDataChanged.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function() {...};