Event: isTrusted property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{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 click event fired through {{domxref("HTMLElement.click()")}} sets the isTrusted property to false.

Value

A boolean value.

Example

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}