File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Copy content to clipboard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Copy content to clipboard" Watch "Copy content to clipboard" New topic

Copy content to clipboard

vineet kumar chaudhry
Ranch Hand

Joined: Apr 02, 2011
Posts: 45

Do we have javascript that copies the contents to clipboard and which is atleast compatible with common browser like IE,Firefox,Chrome,Safari

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Modern day browsers have security settings preventing it from happening. That is why the copy function here on the code blocks does not work. Only way for a pure JavaScript solution is to work is the user changes security settings. Other way around it is using a little flash file that does it. Google for it.

vineet kumar chaudhry
Ranch Hand

Joined: Apr 02, 2011
Posts: 45
Are you refering to ZeroClipboard Library in flash10 ?

I agree. Here's the link:
subject: Copy content to clipboard
jQuery in Action, 3rd edition