Matt Cutts: How does Googlebot handle content loaded via AJAX?






Video transcription

MALE SPEAKER Today’s question comes from New York.
Andy wants to know, JavaScript is being used more and more to progressively enhance content on page and improved usability.How does Googlebot handle content loaded, AJAX, or displayed JavaScript and CSS, by JavaScript on page load on page click?
That’s a really great question.

So we are recording this video on May 8,2013 , so I’ll give you the state of the world as of today.
Which is Google is pretty good at indexing JavaScript and being able to render it and bring it into our search results.
So there’s multiple stages that have to happen.First off, we try to fetch all the JavaScript, CSS,all those sorts of resources so that we can put the page under the microscope and try to figure out, OK what parts of this page should be indexed.
What are the different tokens, or words, that should be indexed, that sort of thing.
Next you have to render, or execute, the JavaScript.
And so we actually load things up and we try to pretend as if a real browser is loading that page.

And what would that real browser do.And along the way there are various events you could trigger or fire the page on load,you could try to do various clicks and that sort of thing.
But usually there’s just the JavaScript that would load that as you start to load up the page and that would execute there.And so once that JavaScript has all been loaded,which is the important reason why you should always let Google crawl the JavaScript and the CSS,all those sorts of resources, so that we can execute the page.
So once we’ve fetched all those resources, we try to render,or execute, that JavaScript.And then we extract the tokens, the words that we think should be indexed, and we put that into our index.

Now as of today, there’s still a few steps left.So for example, that’s JavaScript on the page, what if you have JavaScript that’s injected via an iFrame.Well we’re still working on pulling in indexable tokens from JavaScript that are accessible via iFrames,and we’re getting pretty close to that.
As of today I guess they we’re maybe a couple months away.Although, things can vary, depending on engineering resources, and timelines, and schedules,and that sort of thing.But at that point, then you’ll even be able to have included JavaScript that can and the index, that can add a few tokens to the page,or that we can otherwise index.
So Google is doing a relatively good job on Ajax and JavaScript in general.

The thing to bear in mind is that Google is not the only search engine.And so if you want your content to be indexable by every major search engine, do put some thought into, OK do I need to have a static HTML version of my site, because not every single search engine will be able to execute JavaScript at the level that Google does.And so it might be worthwhile having those sorts of resources also available via static HTML pages.
But that’s just a little bit of a snapshot about how Google handles JavaScript, how we’ll handle it the next couple months, and how we’ll handle it going forward.
The only thing to bear in mind is we do reserve the right to put limits on how much we’re going to index or how much time we’ll spend processing a page, just to try to make sure that things are reasonable.
But that gives you a little bit of an idea about how things are handled.

Quick Answer: Google will try to execute JS as the page loads.

Submit a Comment

Your email address will not be published. Required fields are marked *