W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2014

Re: [clipboard events] Spec update

From: Hallvord R. M. Steen <hsteen@mozilla.com>
Date: Mon, 20 Jan 2014 18:59:32 -0800 (PST)
To: Joshua Peek <josh@joshpeek.com>
Cc: public-webapps <public-webapps@w3.org>
Message-ID: <423669083.3464288.1390273172004.JavaMail.zimbra@mozilla.com>
> I'm eager to replace our flash clipboard bridge with this native api.

Uh, I'm glad you like it but I wouldn't hold my breath.. I hope implementors will like it too but I have no way to tell when implementations will actually be available.

> Would this be the correct code to write a string to the clipboard on a
> button click?

Almost, just create a "copy" event rather than a "paste" one ;-)

>  document.getElementById("copytoclipboard").addEventListener("click",
> function() {
>    var event = new ClipboardEvent('paste', {data: 'COPIED!',

This is where 'paste' ought to  be 'copy'. Then it should just work.

> dataType: 'text/plain'});
>    document.dispatchEvent(event);
>  });

-Hallvord
Received on Tuesday, 21 January 2014 02:59:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:21 UTC