|
You last visited: Today at 14:25
Advertisement
How to simulate mouse event with code (problem: isTrusted=true)
Discussion on How to simulate mouse event with code (problem: isTrusted=true) within the Web Development forum part of the Coders Den category.
01/04/2020, 21:46
|
#1
|
elite*gold: 0
Join Date: Apr 2014
Posts: 377
Received Thanks: 34
|
How to simulate mouse event with code (problem: isTrusted=true)
I need to simulate mousemove by javascript ( or maybe jquery)
but any attemps are resulting in isTrusted=false
I got keyboard working, but mouse not...
an example of failed attempt:
Code:
var event = new MouseEvent('mousemove', {
view: window,
bubbles: true,
cancelable: true,
clientX: 500,
clientY: 50,
movementX: 0
});
using this to debug:
Code:
target.onmousemove = function(eventData) {
console.log(eventData);
}
bad result:
Code:
> MouseEvent*{isTrusted: false, screenX: 0, screenY: 0, clientX: 1, clientY: 1,*…}
So I ask you please, do you know any way to "bypass" the isTrusted property or even any browser that ignores that kinda protection?
|
|
|
01/04/2020, 21:53
|
#2
|
elite*gold: 0
Join Date: Apr 2011
Posts: 11,117
Received Thanks: 2,436
|
General Coding -> Web Development
#moved
|
|
|
01/05/2020, 01:11
|
#3
|
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
|
Quote:
Originally Posted by DarkElite99
I need to simulate mousemove by javascript ( or maybe jquery)
but any attemps are resulting in isTrusted=false
I got keyboard working, but mouse not...
an example of failed attempt:
Code:
var event = new MouseEvent('mousemove', {
view: window,
bubbles: true,
cancelable: true,
clientX: 500,
clientY: 50,
movementX: 0
});
using this to debug:
Code:
target.onmousemove = function(eventData) {
console.log(eventData);
}
bad result:
Code:
> MouseEvent*{isTrusted: false, screenX: 0, screenY: 0, clientX: 1, clientY: 1,*…}
So I ask you please, do you know any way to "bypass" the isTrusted property or even any browser that ignores that kinda protection?
|
Quote:
|
The isTrusted read-only property of the Event interface is a Boolean that is true when the event was generated by a user action, and false when the event was created or modified by a script or dispatched via EventTarget.dispatchEvent().
|
You have four options:
1) Use external script for mousemove (Ex:  )
2) Override existing listeners (really difficult with encapsulated / packed) javascript
3) Perform HTTP/POST requests (no browser needed)
Expert mode: (maybe is easy but don't know and won't try anyway)
4) Fork  edit the code for MouseEvent and build
|
|
|
01/08/2020, 17:22
|
#4
|
elite*gold: 0
Join Date: Jun 2013
Posts: 405
Received Thanks: 84
|
The question is why you need the isTrusted event? I've never needed.
|
|
|
08/14/2024, 19:33
|
#5
|
elite*gold: 0
Join Date: Aug 2024
Posts: 1
Received Thanks: 0
|
Quote:
Originally Posted by DarkElite99
I need to simulate mousemove by javascript ( or maybe jquery)
but any attemps are resulting in isTrusted=false
I got keyboard working, but mouse not...
an example of failed attempt:
Code:
var event = new MouseEvent('mousemove', {
view: window,
bubbles: true,
cancelable: true,
clientX: 500,
clientY: 50,
movementX: 0
});
using this to debug:
Code:
target.onmousemove = function(eventData) {
console.log(eventData);
}
bad result:
Code:
> MouseEvent*{isTrusted: false, screenX: 0, screenY: 0, clientX: 1, clientY: 1,*…}
So I ask you please, do you know any way to "bypass" the isTrusted property or even any browser that ignores that kinda protection?
|
hey do you mind sharing the keyboard code that you succeed to make it bypass istrusted?
|
|
|
 |
Similar Threads
|
[question] simulate keypress
08/21/2012 - Cabal Online - 3 Replies
can anyone help me with coding a c++ dll that presses a single keyboard key
for cabal
im creating one but no luck...
quite a noob in c++ :)
|
Simulate click in Npc
08/06/2012 - General Coding - 0 Replies
(sorry for my bad english) =( Hi, there is a way for simulate the clicking on a npc? I need to Know if there and ¿how?. Is for the game Zero online, I want to do is "simulate" a click on an npc in specific, to open a window from anywhere, which normally can not.
I am willing to learn what it takes, I would like to make an executable that simulates the "click".
I thought about making the post in the section for Zero, but I had my doubts, thank you and sorry if you move.
Thanks and hope...
|
Simulate Keyboard input - Tastatureingaben auf unterster Ebene simulieren.
07/18/2012 - .NET Languages - 5 Replies
Hi!
Is there any way to simulate keyboard input in Visual Basic 2005 or higher, so that a Div-X Application receives them?
Hallo!
Gibt es eine Möglichkeit in Visual Basic 2005 oder höher um Tastatureingaben so zu simulieren, dass ein Div-X Spiel diese empfängt?
Thank's
FlixLix100
|
All times are GMT +1. The time now is 14:25.
|
|