Reputation: 5523
I'm writing a script where there will be a button that, when pressed, all data in a <form>
, <div>
or <p>
should be copied to the system clipboard for further use.
I've tried various things but with no luck. So I was wondering if you guys have a solution in either JS or PHP (if exists).
NOTE: users will be using various browsers
IE7 Google Chrome FireFox
Thanks.
Upvotes: 0
Views: 594
Reputation: 63797
Neither PHP (since it's executed server-side) or Javascript can be used to have implement a fully functional copy to clipboard
feature that will work cross-browsers.
Instead the regular method of solving this is to use a flash object which can handle these kind of situations. The flash object can of course be loaded, and often queried, using javascript.
Here are two out of many libraries that provide this functionality:
Upvotes: 2