0

I am using google's api webkitSpeechRecognition and because this is a chrome browser only api, when I run tests on my application it fails because it cannot find the webkitSpeechRecognition variable. When I run the tests on chrome they pass fine, but when I run them in the terminal it fails because of this. I am trying to make a build for the application but this problem is not letting me do so.

Anyone has any experience in this? Or have any suggestions?

FutoRicky
  • 903
  • 2
  • 9
  • 22

1 Answers1

0

You can add simple javascript test to see if feature is available and perform accordingly. Something like this:

 if (!('webkitSpeechRecognition' in window)) {  
     // run specific features
 }

You can also use Modernizr to use browser-specific features conditionally. See also W3C wiki about it.

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87