Bill Dami
Bill Dami

Reputation: 3235

Modify Chrome Omnibox value/text via extension

Via a Chrome extension, is it possible to change text in the Omnibox (address bar), for example after the chrome.omnibox.onInputEntered event is fired? I'm writing an extension that does certain conversions of values and one method of input is via the omnibox's extension keyword mode. I would love to be able to display the converted value right inside the omnibox itself after they hit Enter, instead of having to display some type of dialog/pop-up window, since their focus is already on the omnibox.

Upvotes: 2

Views: 1837

Answers (1)

Mohamed Mansour
Mohamed Mansour

Reputation: 40199

You cannot alter the contents in the omnibox via Extensions, but, you can use the HTML5 History API to do that (not URL text).

I don't know if it will work for your case, but doesn't hurt to try out. https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history

You can use the pushState to change the URL something like this:

history.pushState(null, "New Title", "newpage.html");

There is a good possibility it wont work because it is dependent on the url for the DOM.

Upvotes: 1

Related Questions