xe-clipboard
It depends on the execCommand APIs, support commonly used H5 browser IE, Chrome, Firefox, Opera, Safari, IOS, Android.
compressed by gzip: < 0.5KB
Browser Support
| | | | | |
---|
10+ ✔ | Latest ✔ | 42+ ✔ | 41+ ✔ | 29+ ✔ | 10+ ✔ |
Installing
npm install xe-clipboard
Get on unpkg and cdnjs
<script src="https://cdn.jsdelivr.net/npm/xe-clipboard"></script>
Example
Run Test
<button class="button">Copy</button>
document.querySelector('.button').addEventListener('click', function (evnt) {
if (XEClipboard.copy('Copy this content to the clipboard.')) {
alert('Copy success.')
} else {
alert('The browser is not supported.')
}
})
License
MIT License, 2017-present, Xu Liangzhan