2

I am writing a Chrome extension try to distinguish the search made by Omnibox (address bar) and google.com.

I notice that if I make a search directly from google, the url looks like https://www.google.com/#q=example. While if I search from the Omnibox, the url looks like https://www.google.com/webhp?sourceid=chrome-instant&rlz=1&ion=1&espv=2&ie=UTF-8#q=example

I can distinguish the difference from the url here. But if I make another search in the page opened by Ominbox, it still shows https://www.google.com/webhp?sourceid=chrome-instant&rlz=1&ion=1&espv=2&ie=UTF-8#q=example

Then I am not able to distinguish the difference here.

Is there any way to achieve this?

serv-inc
  • 35,772
  • 9
  • 166
  • 188
  • There are probably many ways to achieve this, and because of that we need an idea of how your code works. – Xan Jun 28 '16 at 12:08

1 Answers1

1

As mentioned in https://stackoverflow.com/a/17930656/1587329, you can use onReferenceFragmentUpdated. The only time it has fired for me is when the omnibox is finally updated. (the onHistoryStatusUpdate event does not contain the final #... ref field)


Older solution: The search via omnibox does not fire a WebRequest.

Thus, you could create a WebRequestListener, say at onBeforeRequest, and check later if such a listener was triggered.

Community
  • 1
  • 1
serv-inc
  • 35,772
  • 9
  • 166
  • 188