The Definitive Guide to Copying and Pasting in JavaScript
Ever wondered how rich text editors and drawing tools on the Web implement copy and paste functionality?
Turns out that clipboard access in JavaScript is pretty limited, yet it's possible to do things like:
- Paste an image from system clipboard into an app
- Copy/paste formatted text (html) from/to an app
- Copy and paste custom objects within an app
The trick basically comes down to using a hidden text input element and hijacking the clipboard events that are happening on it.
See the article below for implementation details:
Written by Dmitry Pashkevich
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#
