Event 介面的 isTrusted 唯讀屬性為一個布林值,若事件物件是由使用者操作而產生,則 isTrusted 值為 true。若事件物件是由程式碼所建立、修改,或是透過 EventTarget.dispatchEvent() 來觸發,則 isTrusted 值為 false


var bool = event.isTrusted;


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


Specification Status Comment
The definition of 'Event.isTrusted' in that specification.
Living Standard  
Document Object Model (DOM) Level 3 Events Specification
The definition of 'Trusted events' in that specification.
Obsolete Adds requirements regarding trusted and untrusted events, though it does not itself define the isTrusted property.
The definition of 'Event.isTrusted' in that specification.
Obsolete Initial definition.


We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 46.0 (Yes) No support [1] 33 No support
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support ? 46.0 (Yes) ? ? 33 No support 46.0

[1] In Internet Explorer, all events are trusted except those that are created with the createEvent() method.