An Update (Kind Of) On How Google Handles JavaScript

Chris CrumSearchNewsLeave a Comment

Share this Post

The latest Google Webmaster Help video provides an update on where Google is on handling JavaScript and AJAX. Well, an update on where they were nearly a year ago at least.

Matt Cutts responds to this question:

JavaScript is being used more and more to progressively enhance content on page & improve usability. How does Googlebot handle content loaded (AJAX) or displayed (JC&CSS) by Javascript on pageload, on click?

“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,” Cutts says. “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, ‘Okay, 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 sort of loading that page, and what would that real browser do? Along the way, there are various events you could trigger or fire. There’s 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 as you start to load up the page, and that would execute there.”

“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,” he continues. “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.”

“As of today, there’s still a few steps left,” Cutts notes. “For example, that’s JavaScript on the page. What if you have JavaScript that’s injected via an iframe? 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’d guess that 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 be able to have even included Javascript that can add a few tokens to the page or that we can otherwise index.”

It’s worth noting that this video was recorded almost a year ago (May 8th, 2013). That’s how long it can take for Google to release these things sometimes. Cutts notes that his explanation reflects that particular point in time. We’re left to wonder how far Google has really come since then.

There’s that transparency we’re always hearing about.

He also notes that Google’s not the only search engine, so you may want to think about what other search engines are able to do. He also says Google reserves the right to put limits on how much it’s going to index or how much time it will spend processing a page.

Image via YouTube

Chris Crum
Chris Crum has been a part of the WebProNews team and the iEntry Network of B2B Publications since 2003. Follow Chris on Twitter, on StumbleUpon, on Pinterest and/or on Google: +Chris Crum.

Leave a Reply