Slashdot Mirror


Googlebot and Document.Write

With JavaScript/AJAX being used to place dynamic content in pages, I was wondering how Google indexed web page content that was placed in a page using the JavaScript "document.write" method. I created a page with six unique words in it. Two were in the plain HTML; two were in a script within the page document; and two were in a script that was externally sourced from a different server. The page appeared in the Google index late last night and I just wrote up the results.

4 of 180 comments (clear)

  1. Nonsense words? by Whiney+Mac+Fanboy · · Score: 5, Funny
    An alert came in in the late evening of March 10th for "zonkdogfology", one of the words in the first pair

    zonkdogfology is a real word:

    zonk-dog-fol-o-gy zohnk-dog--ful-uh-jee
    noun, plural -gies.

    1. the name given to articles from zonk where the summary makes no sense whatsoever.
    Serious question now - is the author of the article worried that the ensuing slashdot discussion will mention all his other nonsense words? I've no doubt slashdotters will find & mention the other words here, polluting google's index....
    --
    There are shills on slashdot. Apparently, I'm one of them.
  2. The Results: by XanC · · Score: 5, Informative

    Save a click: No, Google does not "see" text inserted by Javascript.

  3. Doesn't work; Good (kind of) by The+Amazing+Fish+Boy · · Score: 5, Insightful
    FTFA:

    Why was I interested? Well, with all the "Web 2.0 technologies that rely on JavaScript (in the form of AJAX) to populate a page with content, it's important to know how it's treated to determine if the content is searchable.
    Good. I am glad it doesn't work. Google's crawler should never support Javascript.

    The model for websites is supposed to work something like this:
    • (X)HTML holds the content
    • CSS styles that content
    • Javascript enhances that content (e.g. provides auto-fill for a textbox)

    In other words, your web page should work for any browser that supports HTML. It should work regardless of whether CSS and/or Javascript is enabled.

    So why would Google's crawler look at the Javascript? Javascript is supposed to enhance content, not add it.

    Now, that's not saying many people don't (incorrectly) use Javascript to add content to their pages. But maybe when they find out search engines aren't indexing them, they'll change their practices.

    The only problem I can see is with scam sites, where they might put content in the HTML, then remove/add to it with Javascript so the crawler sees something different than the end-user does. I think they already do this with CSS, either by hiding sections or by making the text the same color as the background. Does anyone know how Google deals with CSS that does this?
  4. google.com/?q=slashdotting+in+google+dollars by kale77in · · Score: 5, Insightful

    I think the actual experiment here is:

    • Create a 6-odd-paragraph page saying what everybody already knows.
    • Slashdot it, by suggesting something newsworthy is there.
    • Pack the page with Google ads.
    • Profit.

    I look forward to the follow-up piece which details the financial results.