Greasy Fork is available in English.

Discussions » Development

js console click() problem / js在控制台中点事件无效的问题

§
Posted: 28 Mei 2023

Why is it that using `click()` in the JavaScript console does not trigger the click event, while using the mouse does work?

为什么在控制台中使用js的click()无法触发点击事件,而使用鼠标就可以。

§
Posted: 28 Mei 2023

$ is jquery and that might be undefined, try using js instead
document.queryselector('.........

Also don't use chinese, use the class in english, that might help

NotYouMod
§
Posted: 29 Mei 2023
Edited: 29 Mei 2023

I see one obvious reason, probably handler checks if click is isTrusted (click event's property), that property indicates if action (in current example, click) was done by the user or the code. You can read about it in MDN. I tried to spoof it in many ways, I used Proxies, replaced prototype, copied event object etc. But nothing worked out, so it's well secured, I don't think it can be spoofed.

Post reply

Sign in to post a reply.