lunedì, marzo 09, 2009

Zero Clipboard

I was doing some investigating on how to copy text to the clipboard and ran across a useful library called “Zero Clipboard” that provides this functionality using an invisible Adobe Flash movie, and a JavaScript interface.

It’s actually fairly simple to do this in Internet Explorer:

window.clipboardData.setData('Text',myJavaScriptVar)

However, Firefox and other browsers are a bit more strict. Since Adobe Flash also has a clipboard event, this library utilizes this capability using JavaScript.

“This library is fully compatible with Flash Player 10, which requires that the clipboard copy operation be initiated by a user click event inside the Flash movie. This is achieved by automatically floating the invisible movie on top of a DOM element of your choice. Standard mouse events are even propagated out to your DOM element, so you can still have rollover and mouse down effects.”