clipboardDataNN n/a IE 5(Win) DOM n/a  

  

The clipboardData object (accessible as a property of a window or frame object) is a temporary container that scripts in IE 5 and later for Windows can use to transfer text data, particularly during script-controlled operations that simulate cutting, copying, and pasting, or that control dragging. Your script controls what data is stored in the clipboardData object, such as just the text of an element, an element's entire HTML, or the URL of an image. For example, a page for children could display simple icon images of several different kinds of animals. If the user starts dragging the dog icon, the script initiated by the img element's onDragStart event handler stores a custom attribute value of that element (perhaps the URL of a pretty dog photo) into the clipboardData object. When the user drops the icon into the designated area, the onDrop event handler's function reads the clipboardData object's data and loads the photo image into position on the page.

Data stored in this object survives navigation to other pages within the same domain and protocol. Therefore, you can use it to pass text data (including arrays that have been converted to strings by the Array.join( ) method) from one page to another without using cookies or location.search strings. But this is not the system clipboard (for security reasons).

For more information on transferring data via this object and the event.dataTransfer object, visit http://msdn.microsoft.com/workshop/author/datatransfer/overview.asp.

 
HTML Equivalent

None.

 
Object Model Reference
 
[window.]clipboardData
 
Object-Specific Properties
 
dropEffecteffectAllowed
 
Object-Specific Methods
 
clearData( )getData( )setData( )
 
Object-Specific Event Handler Properties

None.

dropEffect, effectAllowedNN n/a IE 5(Win) DOM n/a  

Read/Write  

These two properties belong to the clipboardData object by inheritance from the dataTransfer object, to which they genuinely apply. Ignore these properties for the clipboardData object.

clearData( )NN n/a IE 5(Win) DOM n/a  

clearData([dataFormat])

  

Removes data from the clipboardData object.

 
Parameters
 
dataFormat

An optional string specifying a single format for the data to be removed. Earlier plans to allow multiple data types appear to have fallen through. As of IE 6, the only reliable format is Text. Omitting the parameter removes all data of all types.

 
Returned Value

None.

getData( )NN n/a IE 5(Win) DOM n/a  

getData(dataFormat)

  

Returns a copy of data from the clipboardData object. The clipboardData contents remain intact for subsequent reading in other script statements.

 
Parameters
 
dataFormat

A string specifying the format for the data to be read. Earlier plans to allow multiple data types appear to have fallen through. As of IE 6, the only reliable format is Text.

 
Returned Value

String.

setData( )NN n/a IE 5(Win) DOM n/a  

setData(dataFormat, stringData)

  

Stores string data in the clipboardData object. Returns Boolean true if the assignment is successful

 
Parameters
 
dataFormat

A string specifying the format for the data to be read. Earlier plans to allow multiple data types appear to have fallen through. As of IE 6, the only reliable format is Text. While the method accepts URL as a format, reading a set value in that format is not successful.

stringData

Any string value, including strings that contain HTML tags.

 
Returned Value

Boolean value: true | false.