Trigger actions from the omnibox

You can allow users to interact with your extension through the Chrome omnibox (usually called the address bar). When a user enters extension-defined keywords in the omnibox, your extension controls what the user sees in the omnibox. The Omnibox New Tab Search sample extension uses "nt" as the keyword. When the user types "nt" into the omnibox, it activates the extension. To signal this to the user, it grayscales the provided 16 by 16 icon and displays it in the omnibox next to the extension name.

An example of using the ominibox to trigger an action.

The entered text causes Chrome to send an event to the omnibox.onInputEntered event handler. In the handler, the extension opens a new tab containing a Google Search for the user's entry.

chrome.omnibox.onInputEntered.addListener((text) => {
  // Encode user input for special characters , / ? : @ & = + $ #
  const newURL = `${encodeURIComponent(text)}`;
  chrome.tabs.create({ url: newURL });