22

I currently have something like this

<p class="test"></p>

<script type="text/javascript">
    $(document).ready(function() {
          $(".test").html("hey");
    });
</script>

Will search engines be able to spider the "hey" text? and if yes, what method can I use to prevent that.

Matthew Hui
  • 3,241
  • 2
  • 23
  • 37

5 Answers5

24

Despite what is being stated here in other answers and totally contrary to Google's own FAQ, a Google employee named JohnMu answered a question recently in Google Groups about how the GoogleBot came to follow a non-existent URL. (The actual URL was contained within the jQuery code itself and the GoogleBot DID try to follow it.)

jQuery causing 404 errors in Google Webmaster Tools

Google Employee explains how JavaScript and jQuery are indexed

Apparently, Google does attempt to index your JavaScript.

Quote Google's JohnMu:

"I would also recommend not explicitly disallowing crawling of the jQuery file. While we generally wouldn't index it on its own, we may need to access it to generate good Instant Previews for your site."

JohnMu later in the same thread...

"Additionally, we're constantly working on improving processing of JavaScript for web-search in general, so if you use jQuery to pull in content, and the jQuery script is disallowed for Googlebot, then we would not be able to look at that at all."

Community
  • 1
  • 1
Sparky
  • 94,381
  • 25
  • 183
  • 265
  • 2
    So the answer is actually: _Don't count on it_, but some day it probably will since Google is apparently experimenting with it. – ehm Jul 05 '11 at 23:39
  • 2
    This is true and has been know for several years (2009-ish). Not only does it index but it can also run JavaScript and try figure out what it does, several tests have been performed to prove it, that you can of course Google. – Wyck Jul 05 '11 at 23:41
5

No. Search engines (at least Google) don't run javascript. In fact, a way of seeing how the search engines see your page is by disabling javascript and images.

Rodolfo
  • 4,065
  • 21
  • 36
  • Indeed, but maybe they index the string literals from the script's body? – Frédéric Hamidi Jul 05 '11 at 18:11
  • 4
    u can check how google crawl the pages by using google webmaster.They have a tab where it shows what content of your page is crawled... – shashuec Jul 05 '11 at 18:12
  • Thanks. I will check out webmaster central – Matthew Hui Jul 05 '11 at 18:14
  • yes but for that you have to go through some hoops (identify your site as your own, login to Google if you haven't, etc) and then wait until Google crawls your page. I was talking about more immediate results. – Rodolfo Jul 05 '11 at 18:15
  • 2
    This answer is technically incorrect (at least for Google). Google **does** parse your JavaScript. I link to a Google Employee stating such in my answer above. – Sparky Jul 05 '11 at 18:28
1

Google Site Search isn't able to index content contained in JavaScript. source http://www.google.com/support/customsearch/bin/answer.py?answer=72366

Vivek Goel
  • 19,274
  • 22
  • 97
  • 172
0

The answer is No. Having less JavaScript DOM Manipulation and less flash contents at your site is something that is encourages. AMAIK when a robot visits your a page of your site, it doesn't execute the script of that page and indexes what it get at first shot :) Anyway, there is a good article about SEO at here.

Saeed Neamati
  • 33,583
  • 40
  • 128
  • 183
0

Search Engine Spiders are basic browsers, which have functionality just to parse your html content. So basically if you add links or content using JavaScript than SES wont be able to get it.

It's known that JavaScript is unfriendly to SES.

There are SES which use JavaScript parser and they are able to execute just simple javascript.

SES - Search Engine Spider.

Senad Meškin
  • 12,841
  • 4
  • 37
  • 53