Pasting image from clipboardData object

  • Not supported in Firefox
  • Supported in Chrome
  • Not supported in Safari
  • Not supported in IE
  • Not supported in Opera

Chrome has added some additional support to the clipboardData property part of the copy and paste event. It now supports the kind and type property on the items collection of a paste event. This in conjunction with the getAsFile method allows you to copy binary data such as images from the clipboard.

This demo allows you to paste an image from the clipboard. Try it out – copy any image onto the clipboard. You can copy images from other web pages or applications such as Photoshop. Using Chrome, paste the image into this page using only the keyboard shortcut ie Ctrl+V

Object, method, and property compatibility

  Firefox 14.0.1 Chrome 22.0 Safari 6.0 IE 9.0 Opera 12.01
paste event Yes Yes Yes Yes No
paste event on non-editable element No Yes No No No
clipboardData No Yes Yes Yes No
clipboardData.types No Yes Yes No No
clipboardData.items No Yes No No No
clipboardData.getData No Yes Yes Yes No
clipboardData.setData No Yes Yes Yes No
mime types No Yes Yes No No
custom types No Yes Yes Yes No
event.clipboardData No Yes Yes No No
window.clipboardData No No No Yes No

Useful Links