E
E
ertaquo2011-09-19 15:53:12
Google
ertaquo, 2011-09-19 15:53:12

Change your search query on Google

I am writing a small extension for Google Chrome, which will add a few goodies to Google's search results. However, there was such a gag: how to correctly track the change in the search query? And how to get this request in general?
Now I do this on a timer, by checking the document.title and window.location.hash values, and the query string is obtained through the following expression:

document.title.match(/^(.*)-[^-]+$/)[1].trim()

It works in theory, but for some reason I don't like this approach. Can this be tracked by some more cultural method?
For those not in the know, extensions cannot access variables and functions of other scripts on the page, and the google object is not available. So you have to work exclusively through the DOM.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Sokolovsky, 2011-09-19
@inlanger

and to trace changes of a line input of request?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question