Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect x-webkit-speech?

I want to detect if the browser supports x-webkit-speech (speech to text in <input>s) using JavaScript, but it seems impossible. How can I achieve that?

(I want to display a message if the browser or its version does not support it.)

like image 785
Derek 朕會功夫 Avatar asked Feb 20 '23 19:02

Derek 朕會功夫


2 Answers

you can check whether the browser has a support for speech like this:

if( document.createElement('input').webkitSpeech==undefined )
{
  //no speech support
}
like image 137
UVM Avatar answered Mar 03 '23 12:03

UVM


Detect on webkit browser (currently only Chrome) and maybe W3C in future ^_^

if ( !!("webkitSpeechRecognition" in window) || !!("speechRecognition" in window) )

       alert("yeah!")

}
like image 26
xicooc Avatar answered Mar 03 '23 10:03

xicooc