Modern copy to clipboard – Clipboard.js

Category: Forms, Other, Responsive 56 0
Modern copy to clipboard - Clipboard.js

Download   Demo

Clipboard.js is a modern approach to copy text to clipboard


Copying text to the clipboard shouldn’t be hard. It shouldn’t require dozens of steps to configure or hundreds of KBs to load. But most of all, it shouldn’t depend on Flash or any bloated framework. That’s why clipboard.js exists.

Browser Support

This library relies on both Selection and execCommand APIs. The second one is supported in the following browsers.

  • Chrome 42+
  • Firefox 41+
  • IE 9+
  • Opera 29+
  • Safari ✘

Although copy/cut operations with execCommand aren’t supported on Safari yet (including mobile), it gracefully degrades because Selection is supported.

That means you can show a tooltip saying Copied! whensuccess event is called and Press Ctrl+C to copy when errorevent is called because the text is already selected.

For a live demonstration, open this site on Safari.

Related Articles

Add Comment