Real or scripted event flag
Every click and key event says whether the browser made it or a script made it.
Event.isTrusted is true for events created by the browser from real input and false for events a page script creates with dispatchEvent or element.click(). Agents that drive the browser through the DevTools Protocol send input the browser treats as real, so they pass. Agents that script clicks inside the page fail.
What it can and can't do
What the user does: Nothing. It is on every event
It can
- Check the flag on click, key and pointer events
- Ignore or flag untrusted events
- Spot in page scripts that fake clicks
- Combine with timing and movement data
It cannot
- Catch agents that send real input through the DevTools Protocol
- Tell a person from a remote controlled browser
- See who wrote the script
- Block browser extensions that act for you
How it differs between platforms: Tools that send input through the browser's own input path produce trusted events, so the flag only catches simple scripts.
Browser support
How a site asks for it
| API | event.isTrusted |
| Browser compat keys | api.Event.isTrusted |
| How access is granted | none |
| What the user sees | None |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | Not listed |
| How to take it back | Not listed |
| Inside an iframe | Not listed |
Typical flow
- Page listens for click, key and pointer events
- Handler reads event.isTrusted
- False values from user actions suggest scripts
Data you get
Shape: boolean
How often: per event
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
isTrusted | boolean | None | true when the browser created the event | Not listed |
Technical limits
- Trusted for DevTools Protocol input
- Some browser features require trusted events anyway
- Only a hint for security
The story
What it is
The browser stamps each event as genuine or generated by a script, and the page can read the stamp.
For you
You never see it. Your own clicks are trusted. Browser extensions and macro tools that fake clicks in the page can be ignored by sites.
For makers
A false value is a strong sign of an in page script. A true value proves little, because DevTools Protocol input is trusted. Do not rely on it for security decisions alone.
Where you see it
| Type | Example | Apps |
|---|---|---|
| security | A bank page ignores untrusted clicks on the transfer button. | None named |
| shopping | A checkout button refuses untrusted click events to stop in page bots. | None named |
| ads | An ad unit only counts clicks whose event is trusted. | None named |
| games | A browser game drops untrusted key events from auto play scripts. | None named |
| developer | A tester finds that element.click() fails a site that wants real input. | Playwright |
| accessibility | A site must still accept assistive tools that send trusted input. | None named |
Risks
- Blocks some assistive tools
- Bypassed by protocol level input
What the platform says
- MDN: Event.isTrusted. Docs say the property is true when the event was generated by a user action.
Good uses and abuse
Legitimate uses
- Click fraud defense
- Bot defense
Known abuse
- Blocking legitimate assistive or automation tools
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 4 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 0.1 | Rough identifying entropy, when known |
History
- 2015-10, Chrome 46: Event.isTrusted ships in Chrome
Related capabilities
Related
- Machine made input patterns. Can tell whether input has the rhythm of a person or a program
- Mouse movement dynamics. Can track how your cursor moves on the page, to tell people from bots
- Pointer events (mouse, pen, touch detail). Can see where your mouse, finger or pen is and how it moves on the page
- User activation and idle inference. Can see if you recently clicked or typed, and in Chromium if you are idle
Sources
How well checked: Based on official documentation.