
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
clipboard-button
Advanced tools
Copy text to clipboard by clicking a button, using only vanilla javascript without Flash.
Copy text to clipboard by clicking a button, using only vanilla javascript without Flash. This is using the new Selection API and Clipboard API available in the latest browsers.
Browser support: Chrome 43+, Firefox 41+, Opera 29+ and IE10+.
See the demo.
Install using npm
or bower
:
$ npm install clipboard-button --save
$ bower install clipboard-button --save
clipboard-button has no dependencies.
Create a button on your page, and specify the text you want to copy in the data-clipboard-text
attribute:
<button id="myButton" data-clipboard-text="textToCopy">Copy</button>
Initialize clipboard-button by specifying a target button, either by a selector string or element instance:
function success() {
console.log('Copied!');
};
function fail(err) {
console.error('Error!', err);
};
var cpb = clipboardButton('#myButton', success, fail);
You can supply optional callback methods to be called for the success
and error
event. The error
function will be called with the error object as first argument.
To clean up all event handlers and resources, you can call cpb.destroy()
.
To detect whether the browser is supported you can check the static property clipboardButton.supported
.
FAQs
Copy text to clipboard by clicking a button, using only vanilla javascript without Flash.
The npm package clipboard-button receives a total of 0 weekly downloads. As such, clipboard-button popularity was classified as not popular.
We found that clipboard-button demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.