JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10831046
  • Score
    100M100P100Q219619F
  • License MIT

Copy stuff into clipboard using JS with fallbacks

Package Exports

  • copy-to-clipboard

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (copy-to-clipboard) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Copy to clipboard

Simple module exposing copy(input: text) function that would try to use execCommand with fallback to IE specific clipboardData interface and finally, fallback to simple prompt with proper text content & 'Copy to clipboard: Ctrl+C, Enter'

API

copy(input: text) - tries to copy text to clipboard.

Browser support

Works everywhere where there's prompt available. Works best (i.e. without additional keystrokes) in Chrome and, supposedly, IE. FF support to come soon-ish.

Note: not working on IOS atm

See also

MDN April 2015 update on Cut and Copy Commands