This is great news!

At GitHub, we have support in place for this feature in Chrome already. If you 
use a Canary build to visit the site, the copy buttons use the native JS 
`execCommand('copy')` API rather than Flash.

Although IE 11 supports this API as well, we have not enabled it yet. The 
browser displays a popup dialog asking the user for permission to copy to the 
clipboard. Hopefully this popup is removed in Edge so we can start using JS 
there too. I just haven't had a chance to test with it yet.

Right now, there isn't a reliable way to feature detect for this API in JS. We 
use user agent detection instead, just for this feature. Any suggestions here 
would be much appreciated.

It's exciting to see native copy-to-clipboard coming to Firefox. We'll follow 
along in Bugzilla and enable it on github.com when it's ready!

David


On Tuesday, May 5, 2015 at 3:52:45 PM UTC-6, Ehsan Akhgari wrote:
> Summary: We currently disallow programmatic copying and cutting from JS for
> Web content, which has relied on web sites to rely on Flash in order to
> copy content to the clipboard.  We are planning to relax this restriction
> to allow this when execCommand is called in response to a user event.  This
> restriction mimics what we do for other APIs, such as FullScreen.
> 
> Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1012662
> 
> Link to standard: This is unfortunately not specified very precisely.
> There is a rough spec here: <
> https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#miscellaneous-commands>
> and the handling of clipboard events is specified here: <
> https://w3c.github.io/clipboard-apis/>.  Sadly, the editing spec is not
> actively edited.  We will strive for cross browser interoperability, of
> course.
> 
> Platform coverage: All platforms.
> 
> Target release: Firefox 40.
> 
> Preference behind which this will be implemented: This won't be hidden
> behind a preference, as the code changes required are not big, and can be
> easily reverted.
> 
> DevTools bug: N/A
> 
> Do other browser engines implement this: IE 10 and Chrome 43 both implement
> this.  Opera has adopted this from Blink as of version 29.
> 
> Security & Privacy Concerns: We have discussed this rather extensively
> before: <http://bit.ly/1zynBg7>, and have decided that restricting these
> functions to only work in response to user events is enough to prevent
> abuse here.  Note that we are not going to enable the "paste" command which
> would give applications access to the contents of the clipboard.
> 
> Web designer / developer use-cases: This feature has been rather popular
> among web sites.  Sites such as Github currently use Flash in order to
> allow people to copy text to the clipboard by clicking a button in their UI.
> 
> Cheers,
> -- 
> Ehsan
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to