Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

This question already has an answer here:

I have a question about external JavaScript and SEO. Assume I have a site called example.com with and index page of:

<html>
<body>
  <div class='main-container'>
    <script src='http://www.other.com/page.js'></script>
  </div>
</body>
</html>

and

// at http://www.other.com/page.js
document.write('blue fish and green grass');

Will Google crawl what is outputted by www.other.com/page.js? Are there any techniques or strategies to make that content crawlable so that the text 'blue fish and green grass' was indexed?

Edit:

This http://moz.com/ugc/can-google-really-access-content-in-javascript-really seems to suggest that it is not but is also somewhat dated.

share|improve this question

marked as duplicate by John Conde Feb 8 at 13:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
the linked answer is 4 years old and no longer current / relevant –  timpone Feb 9 at 3:17
add comment

2 Answers 2

The best way to identify how google view your page is using fetch as google.

You will then know if the content generated by javascript is crawl by google or not.

In your javascript maybe you can try noscript for the content.

share|improve this answer
    
interesting results with fetch as google.The exact same Javascript with no surrounding html would show as fetch'd by google whereas javascript + heavy html wouldn't. Seems there's more going on than just the presence or absence of Javascript (perhaps a few hundred milliseconds of checking). –  timpone Apr 22 at 16:45
add comment

Google bot may crawls some content generated by javascript, but it's not reliable and the javascript must be very simple. Although your example is very simple and easy to know the results, looks like external javascripts, even in your own site, won't be crawled.

It's very hard, sometimes impossible, to understand which javascript contents should be read by crawlers. You may print some contents lazily after some event. Some contents may be encoded, concatenated, parsed, etc.

The best way to assure you content will be crawled still is pure html.

This link shows real tests to see what contents google crawls. http://moz.com/ugc/can-google-really-access-content-in-javascript-really

share|improve this answer
    
thx for the answer but I'd consider that link out of date. I have examples where Google has crawled external Javascript and most people who use Disqus have seen that comments are indexed. –  timpone Feb 9 at 2:24
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.