MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

Event.isTrusted

翻譯不完整。請協助 翻譯此英文文件

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
DOM
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.
Working Draft Adds requirements regarding trusted and untrusted events, though it does not itself define the isTrusted property.
DOM4
The definition of 'Event.isTrusted' in that specification.
Recommendation Initial definition.

瀏覽器相容性

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.

文件標籤與貢獻者

 此頁面的貢獻者: jackblackevo
 最近更新: jackblackevo,