// requires:
// * the host permission for "https://mdn.github.io/*"
// * the API permission "clipboardWrite"
fetch("https://mdn.github.io/shared-assets/images/examples/favicon144.png")
.then((response) => response.arrayBuffer())
.then((buffer) => browser.clipboard.setImageData(buffer, "png"));clipboard.setImageData() / notebook
clipboard.setImageData()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
// requires the API permission "clipboardWrite"
fetch(browser.runtime.getURL("image.png"))
.then((response) => response.arrayBuffer())
.then((buffer) => browser.clipboard.setImageData(buffer, "png"));