Retrieving content from a client clipboard, like this website

Can someone explain how this site accesses the contents of the clipboard and displays it?

http://snag.gy

I am working on a similar project and should use this function where users can ctrl + v insert an image. Also, if the site uses the Java plugin, why doesn't my chrome give an outdated warning?

Any help is appreciated!

Thanks.

+7
source share
1 answer

You should be able to say this by looking at the source ( http://snag.gy/assets/js/index.min.js ). The code will be unreadable as it will be reduced, but you can make it readable with a decoder code (e.g. http://jsbeautifier.org/ ).

It uses a java applet to read your clipboard (it dynamically adds it to the page). It also contains a link to http://code.google.com/p/zeroclipboard/ , which is called the flash solution here . I saw that it also uses the clipboardData object.

It seems that depending on the browser there are several backups, and also uses different mechanisms based on the origin of the copied data. You can start with How does the paste image from the clipboard function work in Gmail and Google Chrome 12+? and disappears into the java applet if the browser is older.

+1
source

All Articles