Implement your own voice commands

Voice commands implementation guide

Website voice commands

If you own a website and want to provide voice commands for those users that have installed the Handsfree for Web extension, you can export the commands and make them available.

Similar to the commands definition of the modules, a website voice command is described as a name and an action that will be executed once the command is pronounced by the user.

In order to tell to the extension the available commands, it's necessary to execute a global function called handsfreeCommands and share with it via a parameter the command list.

Setting website voice commands

window.onload = function() {
    name: 'open contact section',
    help: 'Opens the contact section of this website',
    group: 'Website sections'
    action: function() {
      window.location.href = '/contact.html';
  }, {
    name: 'open home page',
    help: 'Opens the home page of this website',
    group: 'Website sections'
    action: function() {
      window.location.href = '/';

There is no context for the website commands, they are allowed to be executed at any time and they have precedence over the commands supported by the application and those were imported via a custom module.

Since the website commands are not part of a context, probably you will need to update the available commands depending of the user interaction. For example, if the user opens a section, a new list of voice commands must be provided. The function handsfreeCommands can be called multiple times with the latest available voice commands.

Here the website voice command properties.

Property Required Type Description
name yes string Define what the user should pronounce in order to be executed
action yes function Define the function that will be executed when the user pronounce the command
group no string Defaults to ''. Useful to display to the user commands grouped by categories
help no string Defaults to ''. Useful to display to the user a description of the command when asks for help

As an example, this same page has loaded website voice commands, if you have running the Handsfree for Web extension you can call one of the following commands.

  • open download section
  • open features section
  • open documentation section
  • open contact section
  • open test section

About this tool

Javier Perez UNLP Unigranrio

The extension Handsfree for Web was built by Javier Pérez in order to bring a handsfree web navigation alternative.

The app was presented as an implementation of a handsfree web navigation model described into the final work Handsfree browsing driven by voice commands for the degree Computer Science at Universidad Nacional de La Plata.


Students of the Unigranrio University have submitted the portuguese version of the extension.
Special thanks go to:

  • Matheus Freitas
  • João Victor Plessim
  • Gabriel Francisco
  • Guilherme Cabral
  • Lucas Hermida