omnibox

Enables extensions to implement customised behavior when the user types into the browser's address bar.

When the user focuses the browser's address bar and starts typing, the browser displays a drop-down list containing suggested pages, based on what they typed. This gives the user a quick way to access, for example, pages from their history or bookmarks.

The omnibox API provides the extension a way to customise the suggestions displayed in the drop-down, when the user enters a keyword defined by the extension. It works as follows:

First, the extension must include an "omnibox" key in its manifest.json file, which defines a keyword.

When the user focuses the address bar and types the keyword, followed by a space, the extension will get an omnibox.onInputStarted event.

As the user continues to type characters after this, the extension will get omnibox.onInputChanged events. The event listener will be passed the current value the user has typed, and will be able to populate the address bar drop-down with suggestions. If the extension set a default suggestion using omnibox.setDefaultSuggestion(), then this will appear first in the drop-down.

If the user accepts a suggestion, the extension will get an omnibox.onInputEntered event. The event listener will be passed the accepted suggestion.