Stony
Stony

Reputation: 3624

How can I detect url change in address bar in chrome extension?

I want to develop an extension, which can detect what I typed words in address bar. If the words match something, it will show the specified url in address bar.

Actually, it's like as Google Chrome did by itself. But I will let the browser detect my keyword firstly, and show the specified url. Only when can't match my keywords, then show the url google provided.

Upvotes: 1

Views: 2610

Answers (2)

Métoule
Métoule

Reputation: 14472

I'm not sure it matches exactly what you need, but you can have a look at the Omnibox API:

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.

Upvotes: 1

Nick
Nick

Reputation: 4092

This is not possible, but you could create your own address bar in HTML and monitor it for changes.

When users type a keyword, you could modify the window.location in another window. You could also modify the same window to show the url contents in an IFrame for instance.

Upvotes: 0

Related Questions