3
3
3042017-10-10 15:20:10
JavaScript
304, 2017-10-10 15:20:10

How does the browser distinguish between a user click and a simulated click?

Suppose there is a button to expand the page to full screen.
When a user clicks, the page expands to full screen, and when a click is simulated (for example, after a timeout), the browser blocks this action.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
3
304, 2017-10-10
@304

Found
the answer. The property of the Event object is responsible for this - isTrusted
https://developer.mozilla.org/en/docs/Web/API/Even...
Thanks Nikita Polevoy

O
Optimus, 2017-10-10
Pyan @marrk2

I can be wrong, but clicking on the button to expand to full screen will happen already in Windows on the browser window, outside the active area of ​​​​the screen in which JavaScript can work

A
Alexander Aksentiev, 2017-10-10
@Sanasol

$('.button').trigger('click'); // и аналоги
This is not a click simulation, the browser/js is not capable of any kind of click simulation.
The normal option is to call what should cause a click, i.e. end function.
Or use not a regular browser, but one made to imitate.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question