Jump to content

Live Clipboard

From Wikipedia, the free encyclopedia
Live Clipboard
Developer(s)Microsoft
Preview release
0.93
TypeCut, copy and paste
LicenseFreeware
Websitecode.msdn.microsoft.com/liveclipboard/

Live Clipboard is an extensible data format and set of UI technologies used to support copy/paste operations between web applications in browsers, and between web and desktop applications. Unlike the typical copy/paste experience in browsers, the Live Clipboard mechanism never needs to display a security dialog to the end user, thus delivering a more streamlined user experience.

Live Clipboard is licensed under the Creative Commons Attribution-ShareAlike License (version 2.5). As of late 2009, the updated specification, Javascript files and sample code can be found here:[1][2]

DHTML technical introduction

[edit]

The Live Clipboard DHTML provides copy/paste functionality for data associated with a web page using the Live Clipboard XML data format. It consists of the following components:

  • UI elements for displaying the Live Clipboard icon
  • Javascript objects representing the Live Clipboard object model
  • Javascript that handles serialization and de-serialization of the Live Clipboard XML data
  • Javascript callback function registration for retrieving data for copy and pushing data for paste.

It is designed to use standard Javascript and CSS techniques to “bring the clipboard to the web” and to work in as many browsers as possible. Currently, it is verified to work in IE 8 and in Mozilla Firefox 3.5.2. The control does not depend on installation of any client-side applications or browser plug-ins, and it never gains access to the contents of the clipboard without explicit user action.

How it works

[edit]

The control positions a transparent (opacity = 0) input element in a containing div element with a background .png image of the clipboard icon. When the user gives focus to the input by left- or right-clicking it, tabbing etc. the control script gets the data that should be copied by calling the OnGetLiveClipboardData function. This callback function is implemented by the page developer and returns an instance of LiveClipboardClass containing the data that should be copied to the clipboard. Next, the control script serializes this data to the Live Clipboard XML format, which it sets as the value of the input element and selects.

At this point, if the user issues a "copy" command via the context menu, browser edit menu, ctrl-C command etc., the selected contents of the input are put on the clipboard. Alternately, if the user issues a "paste" command, the value of the input is replaced with the current data on the clipboard. In this case, the control script detects that the input value has changed, de-serializes the value from Live Clipboard XML format to an instance of LiveClipboardClass, and passes the object to the OnHandleLiveClipboardData function.

The paste callback function is implemented by the page developer and responds to the pasted data as desired. Specifically, it might iterate through the present data formats, apply data in any recognized format(s) to the page, make an asynchronous call to the web server to persist state, set up a new feed subscription, etc. It is also valid to do nothing, such as when none of the formats in the pasted data are valid for the associated data.

There are mechanisms to use keyboard events to trigger copy/paste. This is accomplished by calling the InitiateKeyboardCopyToLiveClipboard and InitiateKeyboardPasteFromLiveClipboard functions.

References

[edit]
  1. ^ "Live Clipboard".
  2. ^ Arrington, Michael (7 March 2006). "Microsoft Live Clipboard – "Wiring the Web"". TechCrunch.
[edit]