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:
omnibox.onInputStarted
event.omnibox.setDefaultSuggestion()
to define the first suggestion that will be displayed in the address bar drop-down.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.omnibox.onInputEntered
event. The event listener will be passed the accepted suggestion.omnibox.onInputCancelled
event.omnibox.OnInputEnteredDisposition
omnibox.SuggestResult
omnibox.setDefaultSuggestion()
omnibox.onInputStarted
omnibox.onInputChanged
omnibox.onInputEntered
omnibox.onInputCancelled
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
OnInputEnteredDisposition |
Yes |
79 |
52 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
SuggestResult |
Yes |
79 |
52
'description' is interpreted as plain text, and XML markup is not recognised.
|
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
onInputCancelled |
Yes |
79 |
52 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
onInputChanged |
Yes |
79 |
52 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
onInputEntered |
Yes |
79 |
52 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
onInputStarted |
Yes |
79 |
52 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
setDefaultSuggestion |
Yes |
79 |
52
'description' is interpreted as plain text, and XML markup is not recognised.
|
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
Note: This API is based on Chromium's chrome.omnibox
API.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/omnibox