Socket
Socket
Sign inDemoInstall

xe-clipboard

Package Overview
Dependencies
0
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    xe-clipboard

纯 Javascript 实现复制文本到剪贴板,支持IE、Chrome、Firefox、Opera、Safari、IOS、Android


Version published
Weekly downloads
311
increased by5.42%
Maintainers
1
Install size
14.2 kB
Created
Weekly downloads
 

Readme

Source

xe-clipboard

gitee star npm version npm downloads gzip size: JS npm license

基于 execCommand API 实现复制内容到剪贴板,支持主流的 H5 浏览器 IE, Chrome, Firefox, Opera, Safari, IOS, Android
压缩大小 < 0.5KB

Browser Support

IEEdgeChromeFirefoxOperaSafari
10+ ✔Latest ✔42+ ✔41+ ✔29+ ✔10+ ✔

Installing

npm install xe-clipboard
<script src="https://cdn.jsdelivr.net/npm/xe-clipboard"></script>

Example

Run Test

<button id="btn1">Copy</button>
document.getElementById('btn1').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 © 2017-present, Xu Liangzhan

Keywords

FAQs

Last updated on 17 Jun 2021

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