Chrome 语音识别输入

十一 26th, 2011

发现淘宝首页的搜索框支持语音识别输入。

稍微研究了下发现是Google Chrome 支持语音识别输入。

做了个简单的Demo:

<!Doctype html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head>
  <title>test</title>
</head>

<body>
<input type="text" id="a" name="a" autofocus="true" autocomplete="off"
 x-webkit-speech="" x-webkit-grammar="builtin:translate" />

</body>

</html>

注意:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">

lang务必用zh
要不然对着麦克风说半天中文识别出来的都是废。

用Chrome同学可以在下面的输入框里看到个麦克风。

目前还没有任何评论.