How to simulate mouse event with code (problem: isTrusted=true)

01/04/2020 21:46 DarkElite99#1
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 False#2
#moved
01/05/2020 01:11 elmarcia#3
Quote:
Originally Posted by DarkElite99 View Post
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: [Only registered and activated users can see links. Click Here To Register...])
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 [Only registered and activated users can see links. Click Here To Register...]edit the code for MouseEvent and build
01/08/2020 17:22 lnqlorlouz#4
The question is why you need the isTrusted event? I've never needed.
08/14/2024 19:33 protecteur6#5
Quote:
Originally Posted by DarkElite99 View Post
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?