MDN self-hosted library · e01.org

Event: isTrusted property

DOM

Open notebook · 1 cells web-api-instance-property upstream source

DOM

The isTrusted read-only property of the 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 HTMLElement.focus()), and false when the event was dispatched via EventTarget.dispatchEvent(). The click event fired through HTMLElement.click() sets the isTrusted property to false.

Value

A boolean value.

Example

if (e.isTrusted) {
  /* The event is trusted */
} else {
  /* The event is not trusted */
}

Specifications

Browser compatibility