R
R
rashitvarisov2018-02-16 23:05:40
JavaScript
rashitvarisov, 2018-02-16 23:05:40

How to simulate click and paste link on form input using javascript?

I want to simulate clicking and pasting a link in an input form using javascript.

(There are sites that, when inserting a link to a video, show detailed information, but through the code it simply inserts, detailed information does not pop up).

On the VKontakte site, if you try to add a video from youtube (i.e. when you insert the youtube link into the form for adding a VKontakte video with the mouse, additional information comes out, and if through javascript, then it simply inserts the youtube link, but additional information does not come out)
5a8994c1d4183196192940.png
5a8994a1e4e12204453515.png
If with the mouse insert a link:
5a8994cf0c837832448463.png
If through the code:
5a8994e15a0b4201581613.png
5a8994ee3e95c697055418.png

I tried to do this with the jQuery library:

$("input").val("111"); 
jQuery("body *").blur();
jQuery("body *").focus();


etc. focus, but does not respond. What else can be added so that everything is the same as if done through the mouse?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2018-02-16
@Stalker_RED

Depends on what exactly the form developers are checking, in each case.
If they check isTrusted , then you can't fake it at all, unless you modify your browser with a file.

A
Alexander null, 2018-02-17
@snikes

I do not quite understand the task
of clicking, you can do this $(element).trigger('click');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question