PDA

View Full Version : check clipboard


aEr_aEr
10-31-2002, 09:56 AM
Is there in javascript a function to check if there is something on the clipboard?

beetle
10-31-2002, 02:36 PM
I don't know of anything. If it exists, probably by route of ActiveX only.

ConfusedOfLife
10-31-2002, 03:23 PM
I don't know either! I just joined to see if anybody knows.

aEr_aEr
10-31-2002, 03:34 PM
I found something.
for the ones that are interested.
the window object has a clipboarddata object

clipboardData = window.clipboardData;
clipboardData.setData('Text', 'the text on the clipboard');
alert(clipboardData.getData('Text'));
clipboardData.clearData();
alert(clipboardData.getData('Text'));

I don't know if this works, because i don't test it yet

I will test it as soon as i've got time if someelse knows more about the clipboardData object. please let me know

beetle
10-31-2002, 03:52 PM
aEr_aEr

Yes, I see that too, here (http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/clipboarddata.asp)

It appears those three methods are all this object has...

Looks like it's IE only too (which I figured...) and became available in version 5.