Javascript Reference
Categories: clipboardData

javascript clipboardData Description

@March 15, 2008, 1:22 a.m.
clipboardData Firefox/Netscape/NN n/a IE 5(Win) Chrome/Safari/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.

 
HTML Equivalent

None.

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

None.

 


Powered by Linode.