Giter Site home page Giter Site logo

js-copy-and-send-image's Introduction

js-copy-and-send-image

最近有一个需求是把聊天窗口中的图片复制并发送给其他人。

但是,很不幸,chrome自从2012年以后就不支持JS复制网页图片,这个issue挂在chromium上很多年了,似乎并不打算支持了。

社区上比较著名的clipboard.js也不支持复制图片。

w3c新出的clipboard-apis同样不支持复制图片,社区其实是希望能支持的。

所以只好通过hack的方式来解决了。

解决思路如下:

1、 复制图片的url

2、通过canvas转换为dataURL

3、将dataURL发往后端

4、后端返回新图片链接,插入到聊天窗口中

js-copy-and-send-image's People

Contributors

hushicai avatar

Stargazers

jiangliehu avatar

Watchers

 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.