Answer the question
In order to leave comments, you need to log in
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
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
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
$('.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 questionAsk a Question
731 491 924 answers to any question