[whatwg] Script-invokable copy action

Hi. I am an author & web developer.

Searching the latest HTML5 spec I could find [1], the only references to a command to copy to clipboard involve the drag-and-drop API.

I personally would like to see a cross-browser way to invoke a copy-to-clipboard command without using any drag-and-drop APIs. I understand access to the clipboard is sensitive.

I call for user agents to respond to a JavaScript method that takes one parameter and assigns it to the clipboard, if the user trusts the site (as determined by the user agent). Good UAs would remember preferences by domain after warning the user about the copy action's sensitivity.

The inability to copy to clipboard via JS is one of the few technical superiorities plugins and native apps have over web standards-based apps, and I would like HTML5 to support this functionality. It will be easier for me, an author, to implement than by using a plugin; it will save me bandwidth; and it benefits my end users.

An example use case: Allowing users to click a button to copy a short URL (rel-shortlink value) to their clipboard, for sharing.

[1]: http://www.w3.org/TR/html5/editing.html#copy-to-clipboard

Received on Monday, 22 February 2010 14:37:30 UTC