Comment: Html5 supports voice search, but unfortunately, only webkit core browsers can use it very simple. You only need to add the attribute x-webkit-speech to input. Interested friends can learn about it.
Html5 supports voice search, but unfortunately only webkit core browsers can use it. The usage is very simple. Just add the attribute x-webkit-speech to input. The example is as follows: <input type=text x-webkit-speech />
In this way, there will be an "small microphone" on the right side of your input box, and it will be prompted when clicked
Then you can tell it and recognize it, such as Taobao store voice search:
Other attributes of voice input: lang is the language type
You can control the language type of speech in the input box, for example <input type=text x-webkit-speech lang=zh-CN/>
Currently, only onwebkitspeechchange is known. As the name implies, it is an event triggered when the speech changes. It can generally be submitted as a submission <input type=text x-webkit-speech onwebkitspeechchange=$(this).cloest('form').submit()/>. This way, it will automatically search after you finish saying it.x-webkit-grammar: This is not a property used for voice search, but it can control the syntax of this input. For example, when doing a search box, you can use <input type=text x-webkit-speech x-webkit-grammar=bUIltin:search /> x-webkit-grammar:
Make the content input of the voice as close as possible to the search content, and remove unnecessary characters, such as "the".
Here is a small example to test:<html>
<body>
<inputtype="text"accesskey="s" autofocus="true" autocomplete="off"name="value_2"id="value_2"x-webkit-speech lang="zh-CN" x-webkit-grammar="bUIltin:search">
<button type="submit">Search</button>
</body>
</html>
The effects are as follows: