nh-copy

0.0.1 • Public • Published

nh-copy

A complete solution to copy text in browser.

It uses zeroClipboard by default to perform copy operation, if browser do not support flash use document.execCommand() instead.

Test this example

bower install

Open index.html.

Support browser

Using zeroClipboard and document.execCommand().

  • IE9+
  • Firefox 41+ (tested in Firefox 41, OS: ubuntu 14.04 64bit)
  • Chrome 43+ (tested in Chrome 45, OS: ubuntu 14.04 64bit)

Using document.execCommand() only.

  • IE9+
  • Firefox 41+ (tested in Firefox 41, OS: ubuntu 14.04 64bit)
  • Chrome 43+ (tested in Chrome 45, OS: ubuntu 14.04 64bit)

How it works?

If flash is supported use zeroClipboard to perform copy operation. else check if firefox 41+ or chrome 43+ using document.execCommand() and selection API instead.

To do

  • Make sure chrome and firefox version detect function always work properly.
  • Support setting to use document.execCommand() only.
  • Format source code to easy further customization.
  • Add website to use this example.

Reference:

license MIT.

Readme

Keywords

none

Package Sidebar

Install

npm i nh-copy

Weekly Downloads

0

Version

0.0.1

License

ISC

Last publish

Collaborators

  • nhducit