0

I am new to web development. I was looking at Snaggy's feature where you can directly paste an image and it gets uploaded to Snaggy.

I did a little research on StackOverflow and I found that it is near-impossible to read the data from clipboard.

As a newbie, please help me understand how it can be achieved. :)

My references for research:
Get current clipboard content?
Read the client clipboard with jQuery?

Community
  • 1
  • 1
An SO User
  • 23,378
  • 30
  • 119
  • 197

2 Answers2

1

Snaggy is using a java applet to access the clipboard. This technique doesn't work without the Java extension installed and enabled in the browser.

There is no way to read from a visitor's clipboard using JavaScript in any popular browser.

coreyward
  • 68,091
  • 16
  • 122
  • 142
  • IE is "popular" among uneducated users. – Scimonster Apr 10 '14 at 19:07
  • @corey [Not even this?](http://stackoverflow.com/questions/15253468/get-pasted-image-from-clipboard-firefox) – An SO User Apr 10 '14 at 19:07
  • @LittleChild Depends how technical you want to get. You're not accessing the clipboard the OS — you're handling a paste event. This allows for behavior similar to Snaggy, for sure, but you still can't access the clipboard if a user doesn't paste their clipboard. – coreyward Apr 10 '14 at 19:20
  • ahhh .. yes, I want to handle the paste event. :) – An SO User Apr 10 '14 at 19:26
1

I remember there was a possibility to read the clipboard content in Adobe Flash. I'm not very familiar with Flash programming, so I can't really explain how to achieve copy/paste automation, but there it is described how to read/write clipboard data using ActionScript3.0. There is also way using a library, described in this blog.

marcel
  • 482
  • 5
  • 10