You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
paramName
( optional enumerated Type array of paramType )
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.
Parameters

Google Chrome Extensions (Labs)

Omnibox

Omnibox

The omnibox API allows you to register a keyword with Google Chrome's address bar, which is also known as the omnibox.

A screenshot showing suggestions related to the keyword 'Chromium Search'

When the user enters your extension's keyword, the user starts interacting solely with your extension. Each keystroke is sent to your extension, and you can provide suggestions in response.

The suggestions can be richly formatted in a variety of ways. When the user accepts a suggestion, your extension is notified and can take action.

Manifest

You must include an omnibox keyword field in the manifest to use the omnibox API. You should also specify a 16x16-pixel icon, which will be displayed in the address bar when suggesting that users enter keyword mode.

For example:

{
  "name": "Aaron's omnibox extension",
  "version": "1.0",
  "omnibox": { "keyword" : "aaron" },
  "icons": {
    "16": "16-full-color.png"
  },
  "background_page": "background.html"
}

Note: Chrome automatically creates a grayscale version of your 16x16-pixel icon. You should provide a full-color version so that it can also be used in other situations that require color. For example, the context menus API also uses a 16x16-pixel icon, but it is displayed in color.

Examples

You can find samples of this API on the sample page.

API reference: chrome.omnibox

Methods

setDefaultSuggestion

void chrome.omnibox.setDefaultSuggestion(, object suggestion)

Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar.

Parameters

suggestion
( Type array of object )
A partial SuggestResult object, without the 'content' parameter. See SuggestResult for a description of the parameters.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.
description
( Type array of string )
The text to display in the default suggestion. The placeholder string '%s' can be included and will be replaced with the user's input.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

Returns

Callback function

The callback parameter should specify a function that looks like this:

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...};

This function was added in version . If you require this function, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

Events

onInputCancelled

chrome.omnibox.onInputCancelled.addListener(function() {...});

User has ended the keyword input session without accepting the input.

Parameters

onInputChanged

chrome.omnibox.onInputChanged.addListener(function(string text, function suggest) {...});

User has changed what is typed into the omnibox.

Parameters

text
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.
suggest
( Type array of function )
A callback passed to the onInputChanged event used for sending suggestions back to the browser.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.
Parameters
paramName
( Type array of SuggestResult array of paramType paramType )
Array of suggest results
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

onInputEntered

chrome.omnibox.onInputEntered.addListener(function(string text) {...});

User has accepted what is typed into the omnibox.

Parameters

text
( Type array of string )
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

onInputStarted

chrome.omnibox.onInputStarted.addListener(function() {...});

User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events.

Parameters

Types

SuggestResult

paramName
( Type array of object )
A suggest result.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.
content
( Type array of string )
The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.
description
( Type array of string )
The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.