Socket
Socket
Sign inDemoInstall

clipboard-js

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
17K
increased by20.55%
Maintainers
1
Install size
20.4 kB
Created
Weekly downloads
 

Readme

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

Last updated on 26 Oct 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc