Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an external JS file embedding some content inline in a web page.

Basically it just does a document.write("my content") via a script tag and loaded externally with the src attribute.

Any chance for this content to be indexed?

Answer seems obviously negative but I have a slight hope while crawlers have surprising abilities.

share|improve this question
up vote 3 down vote accepted

No, they won't see such content.

share|improve this answer
This is not strictly true. Google can index JavaScript generated content to some degree, and it is only going to get better. I manage an old site that has an incredulous amount of document.write() content and some of this is indeed indexed. However, it is certainly very hard for search engines to index and notoriously unreliable, but there is certainly a "chance". – w3dk Sep 22 '12 at 19:57

The noscript tag won't help much


One of the problems with noscript is - as others have mentioned - that it's been abused quite a bit by spammers, so search engines might treat it with some suspicion. So if this is really important content, then I wouldn't rely on all search engines treating your noscript elements in the same way as normal, visible, static content on your pages. If this is "just" for comments, then that might be worth considering regardless, especially if the alternatives are much more complicated

share|improve this answer

Yeah it is possible that this part can be visible in the search engines , there is a project called #! (hash bang) according to this if you have any javascript code introduced in yourpage you can surely index it in the search engines by making a anchor tag with the reference starting with a #! . try it it might help but i m not sure about your perticular problem.

share|improve this answer
I would agree that this JavaScript content could be indexed. However, #! (hashbang) URLs are for indexing pages that are dynamically loaded using AJAX, that would not otherwise have a canonical URL. It is not necessary for indexing arbitrary content that is rendered with JavaScript which would seem to be the case in question. – w3dk Sep 22 '12 at 18:31

Search engines do not parse javascript so document.write() would not be indexed by search engines. One way you might be able to get around this is by having text in noscript tags.


<noscript>Text goes here</noscript>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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