The isTrusted
read-only property of the Event
interface is a Boolean
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
Example
if (e.isTrusted) {
/* The event is trusted */
} else {
/* The event is not trusted */
}
Specification
Specification | Status | Comment |
DOMThe definition of 'Event.isTrusted' in that specification. | Living Standard | |
Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'Trusted events' in that specification. | Obsolete | Adds requirements regarding trusted and untrusted events, though it does not itself define the isTrusted property.
|
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
isTrusted
|
Chrome Full support 46 Full support 46 Notes' Starting with Chrome 53 and Opera 40, untrusted events do not invoke the default action. |
Edge
Full support 12 |
Firefox
Full support Yes |
IE No support No No support No Notes' In Internet Explorer, all events are trusted except those that are created with the |
Opera Full support 33 Full support 33 Notes' Starting with Chrome 53 and Opera 40, untrusted events do not invoke the default action. |
Safari
Full support 10 |
WebView Android Full support 46 Full support 46 Notes' Starting with version 53, untrusted events do not invoke the default action. |
Chrome Android Full support 46 Full support 46 Notes' Starting with Chrome 53 and Opera 40, untrusted events do not invoke the default action. |
Firefox Android
Full support Yes |
Opera Android Full support 33 Full support 33 Notes' Starting with Chrome 53 and Opera 40, untrusted events do not invoke the default action. |
Safari iOS
Full support 10 |
Samsung Internet Android Full support 5.0 Full support 5.0 Notes' Starting with Samsung Internet 6.0 and Opera 40, untrusted events do not invoke the default action. |
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.'
- See implementation notes.
Event.isTrusted by Mozilla Contributors is licensed under CC-BY-SA 2.5.