I want to mess around with Speech Recognition API, so I started with the simple page which starts recognition on click on body element. My scripts.js file is:
var recognition = new window.webkitSpeechRecognition();
document.body.addEventListener("click", recognition.start, false);
Now when I click anywhere on body element I have the strange error in Chrome console:
Uncaught TypeError: Illegal invocation
It refers to first line of my HTML code. My HTML file is:
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script src="scripts.js"></script>
</body>
</html>
How do I fix this weird error?