Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine's clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use Flash?

My primary target is IE8, but would like to support FF and Chrome also.

I have seen the technique to do this using Flash, but am looking for a pure js route:
Clipboard access using Flash

like image 975
Chris Ballance Avatar asked Nov 09 '09 14:11

Chris Ballance


People also ask

Can JavaScript access the clipboard?

Accessing the OS clipboard using browser JavaScript has been possible for several years using document. execCommand() .

What is clipboard permission?

Clipboard Permission Manager is a browser extension which allows users to grant JavaScript access to the clipboard on a per-page basis. It should work with any page that uses the W3C Clipboard API.


1 Answers

Since this is a big security risk, all browsers that care about safety don't allow JS to access the clipboard.

The main reason is that many people put their passwords into a text file and then use cut&paste to login. Crackers could then collect the password (and possibly other private information like the word document which you just copied) from the clipboard by cracking a popular site and installing some JS that sends them the content of the clipboard.

Which is why I have flash disabled all the time.

like image 117
Aaron Digulla Avatar answered Oct 20 '22 04:10

Aaron Digulla