Tuesday, August 30, 2005

Be careful of what you have in the clipboard while surfing

If you’re one of those people that uses the clipboard a lot, particularly to copy usernames and sometimes passwords into signin pages on websites, then this is going to be a bit shocking:

http://www.friendlycanadian.com/applications/clipboard.htm

If you click on the link above you should see your clipboard contents highlighted in yellow on the page.

Yes, a website can access the contents of the clipboard from JavaScript, this is the JavaScript code that the test site is using:

<Script Language="JavaScript">

    var content = clipboardData.getData("Text");

    if (content!=null) {

        .

        document.write(content);

        .

    }

    else {

        document.write('<center>No text found in clipboard. This is a good thing!<br><br>Works with Internet Explorer and Netscape.');

    }

</Script>

I emailed my concerns to the IE team so we’ll have to see if anything will be done for IE 7.