点燃“糊”事件在Javascript [英] fire a "paste" event in Javascript

查看:116
本文介绍了点燃“糊”事件在Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个话题多次讨论。
但是这个有点不同。
我需要调度一个粘贴事件(如复制粘贴)。



为什么我需要这样?
当您将一个链接复制到Facebook中的消息文本区域时,您会看到自动调用ajax脚本来更改该页面,以便收件人可以看到连接之外的附件。


$ b $因为我不会使用Facebook API和东西,我只想调用粘贴事件,希望触发我需要的脚本。

解决方案

尝试使用 document.createEvent 必要的参数模仿粘贴动作(例如 CTRL-V )。



可能还有一个粘贴事件可以创建和调度,但浏览器支持可能会(will!)不同。


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.

解决方案

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.

这篇关于点燃“糊”事件在Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆