You can try adding the following snippet to see what error is generated.
recognition.onerror = function(event) { console.log(event.error); });
Most likely, he spits out “invalid”, which usually means that the user agent does not allow you to enter any kind of speech input for reasons of security, privacy or user preference (since you use it locally through the file: //)
Have you tried serving the page under a local web server, for example (IIS or Node)?
source share