Do search engines process Javascript?
Asked Answered
R

6

10

According to this page it would seem like they don't, in the sense that they don't actually run it, but that page is 2 years old (judging from the copyright info).

The reason I'm asking this question is because we use Javascript to replace text on our site with other more typographically sound content. We're worried that this may affect the crawlability/seo of our sites, since generally what we're replacing is headers; ie. <h1>, <h2>, etc.

Will search engine bots see our original code, or will they run the Javascript and see the replaced text?

Remote answered 15/1, 2010 at 0:23 Comment(0)
D
3

Google now officially processes JavaScript.

In order to solve this problem, we decided to try to understand pages by executing JavaScript. It’s hard to do that at the scale of the current web, but we decided that it’s worth it. We have been gradually improving how we do this for some time. In the past few months, our indexing system has been rendering a substantial number of web pages more like an average user’s browser with JavaScript turned on.

  • Sometimes things don't go perfectly during rendering, which may negatively impact search results for your site. Here are a few potential issues, and – where possible, – how you can help prevent them from occurring:
  • If resources like JavaScript or CSS in separate files are blocked (say, with robots.txt) so that Googlebot can’t retrieve them, our indexing systems won’t be able to see your site like an average user. We recommend allowing Googlebot to retrieve JavaScript and CSS so that your content can be indexed better. This is especially important for mobile websites, where external resources like CSS and JavaScript help our algorithms understand that the pages are optimized for mobile. If your web server is unable to handle the volume of crawl requests for resources, it may have a negative impact on our capability to render your pages. If you’d like to ensure that your pages can be rendered by Google, make sure your servers are able to handle crawl requests for resources.
  • It's always a good idea to have your site degrade gracefully. This will help users enjoy your content even if their browser doesn't have compatible JavaScript implementations. It will also help visitors with JavaScript disabled or off, as well as search engines that can't execute JavaScript yet.
  • Sometimes the JavaScript may be too complex or arcane for us to execute, in which case we can’t render the page fully and accurately.
  • Some JavaScript removes content from the page rather than adding, which prevents us from indexing the content.
Development answered 11/10, 2015 at 13:59 Comment(0)
C
3

Search engines don't process JavaScript as such.

There is some evidence that Google may have started processing inline script content in some cases, in order to catch content that is entered into the page parse queue using document.write. However certainly DOM methods such as you might use for font-replacement are not affected and no onload code is invoked.

Curst answered 15/1, 2010 at 0:56 Comment(0)
D
3

Google now officially processes JavaScript.

In order to solve this problem, we decided to try to understand pages by executing JavaScript. It’s hard to do that at the scale of the current web, but we decided that it’s worth it. We have been gradually improving how we do this for some time. In the past few months, our indexing system has been rendering a substantial number of web pages more like an average user’s browser with JavaScript turned on.

  • Sometimes things don't go perfectly during rendering, which may negatively impact search results for your site. Here are a few potential issues, and – where possible, – how you can help prevent them from occurring:
  • If resources like JavaScript or CSS in separate files are blocked (say, with robots.txt) so that Googlebot can’t retrieve them, our indexing systems won’t be able to see your site like an average user. We recommend allowing Googlebot to retrieve JavaScript and CSS so that your content can be indexed better. This is especially important for mobile websites, where external resources like CSS and JavaScript help our algorithms understand that the pages are optimized for mobile. If your web server is unable to handle the volume of crawl requests for resources, it may have a negative impact on our capability to render your pages. If you’d like to ensure that your pages can be rendered by Google, make sure your servers are able to handle crawl requests for resources.
  • It's always a good idea to have your site degrade gracefully. This will help users enjoy your content even if their browser doesn't have compatible JavaScript implementations. It will also help visitors with JavaScript disabled or off, as well as search engines that can't execute JavaScript yet.
  • Sometimes the JavaScript may be too complex or arcane for us to execute, in which case we can’t render the page fully and accurately.
  • Some JavaScript removes content from the page rather than adding, which prevents us from indexing the content.
Development answered 11/10, 2015 at 13:59 Comment(0)
I
2

Generally no. Google has mentioned that they are working on a system of indexing ajax content, but I don't think any of the major search engines index dynamic content as a rule. See this page for Google's take on it: http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=81766

Inflorescence answered 15/1, 2010 at 0:25 Comment(0)
J
1

The bots will certainly not run the Javascript code, but they might recognise some commonly used scripts.

You shouldn't count on it though. Clear markup, proper content and real links is still what counts.

Also, if the bots happen to recognise your script, it might not be in your favor. If the code is recognised as something that is commonly used to try to fool bots, it could even hurt your page ranking.

Jay answered 15/1, 2010 at 1:9 Comment(0)
M
0

I'd use metadata to ensure bots pick up the content on your pages.

Memorial answered 15/1, 2010 at 0:26 Comment(5)
It's pretty well established that "metadata" is explicitly ignored by all search engines.Kimberykimble
Not entirely correct. I believe Google for instance will use the 'description' meta tag if available as the excerpt it displays. This could be wrong too, but this is what I've heard.Remote
The text under Google search results shows your search query in context, or the metadata description (if its algorithm used link text)Memorial
Metadata is indeed ignored because it can fool the bots about the actual content. Only the description may be indexed (Google does) and it will show up as site description in the search results (it will however not be indexed as keywords).Fasano
It will use the description in some cases, but I don't believe it uses that text for indexing keywordsInflorescence
S
0

I know the general consensus is that google does not process javascript or index anything with a <script> tag, however, the general consensus appears incorrect.

Try searching for the following, with the surrounding quotes (or click here):

"Samsung Public Interest Statement by Thomas Fusco, Fish & Richardson P.C., for Samsung."

You should only get one result. Now click on that result (or just click here) and view the source.

Do a CTRL-F for the text you searched for in Google. Notice that the text is in a javascript variable, and not html. Google must be processing some javascript to pull those words into its index.

Shillelagh answered 28/4, 2014 at 1:22 Comment(2)
As noted in the accepted answer, there's evidence of Google processing inline scripts (precisely what is on the linked page) to try to get at dynamic content, perhaps even as nieve as simply looking for strings and unescaping the content which is all that is needed for your example. That's a far cry from actually running scripts, which was the original question.Remote
Don't think so. I have evidence that it's running scripts too. For example try google searching for the following (with the quotes): "DeLaval requested a conference call to seek authorization to file a motion to strike Lely's preliminary response". Again, only one result, which came from a snippet in Docket Alarm's search engine. That snippet was not in the on-page HTML or javascript, it came from a ajax call that generates the snippet. (fyi, the google cache is old so the snippet is no longer on the page).Shillelagh

© 2022 - 2024 — McMap. All rights reserved.