isTrusted Event Property
Definition and Usage
The isTrusted event property returns a boolean value indicating whether the event is trustworthy.
Note:In Chrome, Firefox, and Opera, an event is considered trustworthy if it is triggered by the user, and it is considered untrustworthy if it is triggered by a script. In IE, all events are trustworthy except for those created using the createEvent() method.
Example
Determine if a specific event is trustworthy:
function myFunction(event) { if ("isTrusted" in event) { if (event.isTrusted) { alert("The " + event.type + " event is trusted."); } else { alert("The " + event.type + " event is not trusted."); } } else { alert("The isTrusted property is not supported by your browser"); } }
Syntax
event.isTrusted
Technical Details
Return Value: |
Boolean value indicating whether the event is trusted. Possible Values:
|
---|---|
DOM Version: | DOM Level 3 Events |
Browser Support
The numbers in the table indicate the first browser version that fully supports the property.
Properties | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
isTrusted | 46.0 | 9.0 | Supported | Not Supported | 33.0 |