Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fire a "paste" event in Javascript

I know this topic discussed many times. But this one a bit different. I need to "dispatch" a "paste" event (like after copy "paste").

Why do I need that ? Well when you copying a link into a message textarea in Facebook,you see that automatically ajax script called that alters the page so that recipient could see attached image besides the link.

since I'm not going to use Facebook API's and stuff,I just want to call the paste event that hopefully will trigger the script that I need.

like image 413
Ivelius Avatar asked Jan 09 '12 14:01

Ivelius


1 Answers

Try using document.createEvent and the necessary arguments to imitate the "paste" action (e.g. CTRL-V).

There is likely also a "paste" event which can be created and dispatched but browser support may (will!) vary.

like image 88
maerics Avatar answered Oct 07 '22 18:10

maerics