javascript - 为什么github上复制链接的那个按钮用的flash?
怪我咯
怪我咯 2017-04-10 15:32:38
[JavaScript讨论组]

右边的那个复制的按钮是个flash,为什么呢?

怪我咯
怪我咯

走同样的路,发现不同的人生

全部回复(5)
ringa_lee

出于安全考虑,默认浏览器不能访问剪切板,需要开启才行,但是不是所有人都知道都会这么做,所以用了flash解决这个问题,flash可以访问

怪我咯

解决浏览器兼容性问题

怪我咯

只是一个font icon啊


不好意思,是我自己没看清楚,是有用到flash,@llffzzk 说的对,github用的是这个插件:zeroclipboard

This library is fully compatible with Flash Player 11.0.0 and above,
which requires that the clipboard copy operation be initiated by a
user click event inside the Flash movie. This is achieved by
automatically floating the invisible movie on top of a DOM element of
your choice. Standard mouse events are even propagated out to your DOM
element, so you can still have rollover and mousedown effects with
just a little extra effort.

怪我咯

Ubuntu上Chromium没装flash,果断没有复制按钮。。

伊谢尔伦

主要是兼容性问题吧,虽然有些浏览器提供了复制的API,但是并不通用

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号