IE Users: JavaScript Can Access Your Clipboard

Just read an article over at harriyott.com: Looks like there are JavaScript functions built into IE that not only allow a site to set the contents of your clipboard but retrieve them as well.

IE users, try this one on for size (this only works with Internet Explorer, to my knowledge):

First, click this link to copy the phrase "My Dog Has Fleas" to your clipboard. Now open up a Notepad window (or whatever your favorite text editor is) and paste it in - sure enough, it adds info to your clipboard.

Now copy some arbitrary text to your clipboard. Doesn't matter what it is - type something in that Notepad window, or highlight something on this page, and copy it. Now click this link to show your clipboard contents.

Pretty freaky, huh?

For the curious... the "insert data into clipboard" code is:
window.clipboardData.setData('Text', 'My Dog Has Fleas');

...and the "retrieve data from clipboard" code is:
window.clipboardData.getData('Text');

posted on Thursday, January 20, 2005 8:41 AM | Filed Under [ GeekSpeak ]

Comments

Gravatar # JavaScript in the clipboard
by John at 6/23/2008 5:13 PM
This is interesting, but not very scary because IE asks me if I want the site to be allowed access to the clipboard, and I can deny it. And anyway, it only works in IE.
Gravatar # re: IE Users: JavaScript Can Access Your Clipboard
by gugu at 12/18/2008 4:27 AM
but it reads wihout asking for permission, so why not add some javascript to my site, that sends my clipboard content regulary to some other site? chances are, that there are some pwd among the contents.
Comments have been closed on this topic.