Greasy Fork is available in English.

討論 » 開發

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

§
發表於:2023-05-28

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

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

§
發表於:2023-05-28

$ 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

NotYou管理員
§
發表於:2023-05-29
編輯:2023-05-29

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.

發表回覆

登入以回復