Greasy Fork is available in English.

Discussões » Desenvolvimento

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

§
Publicado: 28/05/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()无法触发点击事件,而使用鼠标就可以。

§
Publicado: 28/05/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
§
Publicado: 29/05/2023
Editado: 29/05/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.

Publicar resposta

Faça o login para publicar uma resposta.