I am trying to make this code work and don't know why it is not working on my local server as well as on my hosting server. I tried the same locally and it works.
( The curious thing is that there is a question here opposite to mine: HTML5 Web Speech API not working locally
Which makes it look even stranger. )
<html>
<head>
<title>Voice API</title>
</head>
<body>
<button
onClick="func()">Click
Me</button>
<script>
function func()
{
alert('Hello');
var recognition =
new
webkitSpeechRecognition();
recognition.continuous =
true;
recognition.interimResults =
true;
recognition.onresult
= function(event)
{
alert(event.
Hi[0][0].transcript);
}
recognition.start();
}
</script>
</body>