3

[Web] 为自己的网站在Chrome中添加语音输入

 2 years ago
source link: https://www.isaced.com/post-145.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

[Web] 为自己的网站在Chrome中添加语音输入

在用谷歌浏览器(Chrome)浏览网站时,你会发现有些网站(比如1616网站导航)的文本输入框的右侧有一个麦克风,点击之后可以进行语音输入(Speech to Text)。 其实这是使用了谷歌浏览器的语音输入API。

如果要为自己的网站也加入语音,只需要在需要输入文本的地方加入以下一行代码即可:

speech=”speech” x-webkit-speech=”x-webkit-speech” x-webkit-grammar=”builtin:translate”

一个例子:

<input type=”text” class=”gspeech” name=”test” speech=”speech” x-webkit-speech=”x-webkit-speech” x-webkit-grammar=”builtin:translate” /> 

为自己的网站在Chrome中添加语音输入

只能在谷歌浏览器中才可以使用语音输入,非谷歌浏览器则会忽略所添加的属性,不会影响网页显示。

在使用谷歌浏览器时,如果也想在其他网站也使用语音输入,则可以安装语音输入扩展。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK