SpeechRecognitionErrorEvent: message 屬性

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

messageSpeechRecognitionErrorEvent 介面的一個只讀屬性,它返回一個更詳細地描述錯誤的字串訊息。

一個字串,包含有關所引發錯誤的更多詳細資訊。請注意,規範並未定義這些訊息的確切措辭——這由實現者決定。

示例

js
const recognition = new SpeechRecognition();

recognition.onerror = (event) => {
  console.log(`Speech recognition error detected: ${event.error}`);
  console.log(`Additional information: ${event.message}`);
};

規範

規範
Web Speech API
# dom-speechrecognitionerrorevent-message

瀏覽器相容性

另見