Giter Site home page Giter Site logo

lhongjum / xe-clipboard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from x-extends/xe-clipboard

0.0 0.0 0.0 48 KB

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

License: MIT License

JavaScript 38.41% HTML 45.02% TypeScript 16.57%

xe-clipboard's Introduction

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

IE Edge Chrome Firefox Opera Safari
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

xe-clipboard's People

Contributors

chekun avatar wekersnail avatar xuliangzhan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.