I'm working on a browser extension that needs to make a call when a new google instant page is served and then modify the results (think SEOQuake).
Issue: If a user pastes a link directly into the url field and presses enter, a new page load will happen and my extension will run. However with google instant, although the url changes as you type the queries, you're technically still on the same page, so the extension fails to run.
I looked at SEOQuake's code and this seems to be how they solve the problem:
document.body.addEventListener("DOMNodeInserted", sq_bindAsEventListener(this, function(event) { //
It's a great solution however it isn't ideal for me because as far as I know, DomNodeInserted isn't supported by IE below version 9. (surprise!)
I'm bundling jQuery along with the app so I have access to all jQuery functions. I was thinking about using .keypress() and simply wait until there's been no input for a second - if it's google instant, I'll know for a fact the page has changed.
Another thought I had is to monitor if the URL has been changed; I can't seem to find any jquery or javascript functions that keep track if the url's been changed.
What's the best way to know that a google instant search has been performed?
A crude solution: use setInterval() and check if the window.top's location changes (that means a new query has been performed).