Question

I'm working on a browser extension (think SEOQuake) - I need to display some data about the search results that are shown.

Issue: If anything is added to the Google Instant results page while it's still in the process of being loaded, it'll overwrite any additions. I caught myself writing some really wonky setInterval business (waiting until the contents of ol#rso stop changing in size, stuff like that) so I suppose that means I'm not sure how to reliably determine if the page is done loading.

I could just have it wait 1-2 seconds but I really want to start fetching the data as soon as the results are loaded to save maximum amount of time.

Edit: Keep in mind, I can't use DOMElementWhatever because IE8 doesn't support it.

Was it helpful?

Solution

Try this:

window.addEventListener("message", function(e) {if(e.data == 'jrc') console.log('loaded')}, false);

That should work in IE 8+ and all other browsers: http://caniuse.com/#feat=x-doc-messaging

If that doesn't work in IE 8 (can't test in on my Mac right now), let me know. I believe I got some reasonably good understanding of the rs.js in the last hour. ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top