-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
39 lines (29 loc) · 888 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
title: "Event: isTrusted property"
short-title: isTrusted
slug: Web/API/Event/isTrusted
page-type: web-api-instance-property
browser-compat: api.Event.isTrusted
---
{{APIRef("DOM")}}{{AvailableInWorkers}}
The **`isTrusted`** read-only property of the
{{domxref("Event")}} interface is a boolean value that is `true`
when the event was generated by the user agent (including via user actions and programmatic methods such as {{domxref("HTMLElement.focus()")}}),
and `false` when the event was dispatched via
{{domxref("EventTarget.dispatchEvent()")}}.
The only exception is the `click` event, which initializes the `isTrusted`
property to `false` in user agents.
## Value
A boolean value.
## Example
```js
if (e.isTrusted) {
/* The event is trusted */
} else {
/* The event is not trusted */
}
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}