Event.isTrusted
The isTrusted
read-only property of the Event
interface is a boolean value that is true
when the event was generated by a user action, and false
when the event was created or modified by a script or dispatched via EventTarget.dispatchEvent()
.
Syntax
var eventIsTrusted = event.isTrusted;
Value
A boolean value.
Example
if (e.isTrusted) { /* The event is trusted */ } else { /* The event is not trusted */ }
Specifications
Specification |
---|
DOM Standard (DOM) # ref-for-dom-event-istrusted① |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
isTrusted |
46
Starting with Chrome 53 and Opera 40, untrusted events do not invoke the default action.
|
12 |
1.5 |
No
In Internet Explorer, all events are trusted except those that are created with the
createEvent() method. |
33
Starting with Chrome 53 and Opera 40, untrusted events do not invoke the default action.
|
10 |
46
Starting with version 53, untrusted events do not invoke the default action.
|
46
Starting with Chrome 53 and Opera 40, untrusted events do not invoke the default action.
|
4 |
33
Starting with Chrome 53 and Opera 40, untrusted events do not invoke the default action.
|
10 |
5.0
Starting with Samsung Internet 6.0 and Opera 40, untrusted events do not invoke the default action.
|
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted