为什么github上复制链接的那个按钮用的flash?

图片描述

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

阅读 4.7k
5 个回答

出于安全考虑,默认浏览器不能访问剪切板,需要开启才行,但是不是所有人都知道都会这么做,所以用了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,但是并不通用

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题