HTML5 - speech recognition with Javascript

Oscar Brito

With Google Chrome 25 installed you can use the native Javascript Speech Recognition API on your browser.

The essential steps to make it work are:

var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;

recognition.onresult = function(event) {
var interimtranscript = '';

for (var i = event.resultIndex; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
transcript += event.results[i][0].transcript;
} else {
interimtranscript += event.results[i][0].transcript;
transcript = capitalize(finaltranscript);
span.innerHTML = linebreak(finaltranscript);
span.innerHTML = linebreak(interim_transcript);


Visit for more informations, contacts and news about Web Development.
See other blog posts at

Divhide purpose is to follow the HTML5 movement and contribute with applications which prove the quality of technology.

Feel free to contact divhide.