THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

isTrusted Event Property

Event Object Reference Event Object

Example

Find out if a specific event is trusted:

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");
    }
}
Try it yourself »

Definition and Usage

The isTrusted event property returns a Boolean value indicating whether the event is trusted or not.

Note: In Chrome, Firefox and Opera, the event is trusted if it is invoked by the user, and not trusted if it is invoked by a script. In IE, all events are trusted except those that are created with the createEvent() method.


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
isTrusted 46.0 9.0 Yes Not supported 33.0

Syntax

event.isTrusted

Technical Details

Return Value: A Boolean, indicating whether the event is trusted or not

Possible values:

  • true - The event is trusted
  • false - The event is not trusted
DOM Version: DOM Level 3 Events

Event Object Reference Event Object