Simple module exposing copy
function that will try to use execCommand with fallback to IE-specific clipboardData
interface and finally, resort to usual prompt
with proper text content and message.
Installation
- Can be used as npm package and then leveraged using commonjs bundler/loader:
npm i --save copy-to-clipboard
- Can be utilized using wzrd.in. Add following script to your page:
Example
import copy from 'copy-to-clipboard'; copy('Text'); // Copy with options copy('Text', { debug: true, message: 'Press #{key} to copy', });
API documentation is available at the following link .