1

I want to set or get data or text to the clipboard, but without flash. Is it possible?

blez
  • 4,645
  • 5
  • 45
  • 77

1 Answers1

1

You can get the clipboard data in WebKit, but only during a paste event, for security reasons (random websites being able to copy from your system clipboard at any time would be bad). Assuming you have a a text input with id "textBox":

Live demo: http://jsfiddle.net/qc4s8/

Code:

document.getElementById("textBox").onpaste = function(evt) {
    alert(evt.clipboardData.getData("text/plain"));
};​

References:

Community
  • 1
  • 1
Tim Down
  • 292,637
  • 67
  • 429
  • 506