Vitalii Ponomar
Vitalii Ponomar

Reputation: 10946

Does google robot index text from javascript document.write()?

Lets say I have this:

<script type="text/javascript">
    var p = document.getElementById('cls');
    p.firstChild.nodeValue = 'Some interesting information';
</script>

<div id="cls"> </div>

So, google robots will index text Some interesting information or not?

Thanks!

Upvotes: 3

Views: 1606

Answers (4)

jottaido
jottaido

Reputation: 11

We've had a need to hide pieces of information on pages from GoogleBot. As the information wasn't extremely sensitive, we've used document.write()-s to avoid searchbots indexing content in question.

Later in 2011 Q3 I've found that GoogleBot did index the scripted content, so I'm pretty sure now that Google is indexing much more than just fetching URLs from content, even though it's really not documented anywhere deeply.

Upvotes: 1

Pankaj Upadhyay
Pankaj Upadhyay

Reputation: 13594

Google doesn't index the JavaScript code or the generated content. You will only see it in the cache because the cached page consists of the complete file including the JavaScript code and your browser renders it. Google does scan JavaScript for URLs to crawl, so if the code is pulling content from an external file via Ajax, etc., there's a chance that the external file will also be indexed, but separate from the parent page. If you want the content to be indexed, it's got to be in plain HTML. Good luck!

Upvotes: 0

Vamsi
Vamsi

Reputation: 4253

Update SearchEngine watch has recently mentioned that Google bot has been improvised to read JavaScript, to quote exactly

it can now read and understand certain dynamic comments implemented through AJAX and JavaScript. This includes Facebook comments left through services like the Facebook social plugin.

Upvotes: 1

Kiran
Kiran

Reputation: 20313

AFAIK, google robot will now indexing AJAX and Javascript stuff.For reference please follow:

http://www.submitshop.com/2011/11/03/google-bot-now-indexing-ajax-javascript

Get google to index links from javascript generated content

Upvotes: 2

Related Questions