Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clipboard-js

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clipboard-js

A web shim to handle clipboard APIs across browsers using a simple Promise API.

  • 0.3.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.9K
decreased by-45.69%
Maintainers
1
Weekly downloads
 
Created
Source

clipboard.js

This library has been superseded by clipboard-polyfill, which works in more browsers.

Here's how to migrate:

Plain Text

// clipboard.js
clipboard.copy("plain text");
// clipboard-polyfill
clipboard.writeText("plain text");

Rich Text

// clipboard.js
clipboard.copy({
  "text/plain": "Fallback markup text.",
  "text/html": "<i>Markup</i> <b>text</b>."
});
// clipboard-polyfill, similar to async clipboard API
var dt = new clipboard.DT();
dt.setData("text/plain", "Fallback markup text.");
dt.setData("text/html", "<i>Markup</i> <b>text</b>.");
clipboard.write(dt);

DOM element

// clipboard.js
clipboard.copy(document.body);
// clipboard-polyfill, similar to async clipboard API
var dt = new clipboard.DT();
dt.setData("text/plain", document.body.innerText);
dt.setData("text/html", new XMLSerializer().serializeToString(document.body));
clipboard.write(dt);

Keywords

FAQs

Package last updated on 26 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc