So, we all know Google hates hidden elements, and rightly so. But I am curious, what if the element is present in DOM normally in the static form, but after page load, it is hidden by JavaScript?

AFAIK Googlebot (and other bots for that matter) cannot interpret JavaScript, so they should not detect this tampering, right?

And consider a case when it is not obvious keyword stuffing and spamming, but probably hidden text to be inserted in other part of the page on some relevant and solicited user event.

  • 1
    Google absolutely understands, runs, and renders pages with JavaScript. So the answer is Yes. Google can tell if you hide elements with JS.
    – closetnoc
    Sep 29, 2016 at 18:33
  • @closetnoc Then why do they give everyone hard time about AJAX and make creating AJAX applications such pain in the rear end? Is it typical case of "we do something only when it suits us?"
    – The Law
    Sep 29, 2016 at 18:34
  • 1
    I do not know about AJAX and Google. It may be conditional. Remember that G makes up their own rules because the can. There is always push-back. Sometimes Google tries to rewrite the rules of the Internet and this consistently fails. But they try anyway. As well, remember that there is a lot of stove-piping at Google and so one hand does not always know what the others are doing (beside slapping us around). ;-) Cheers!!
    – closetnoc
    Sep 29, 2016 at 18:39
  • For the record, this is why Chrome exists. It was the first step in understanding and creating a rendering engine. I have not researched this, however, the scuttlebutt is that you can use Chrome as a rendering engine for your own analysis. You can certainly use FIrefox. This is something I will try working with in a few months to better understand what can be seen by search engines.
    – closetnoc
    Sep 29, 2016 at 18:57

1 Answer 1


Googlebot now renders pages and views the page as a user sees it when it loads, including applying CSS and running JavaScript. Google will detect text that is hidden using either CSS or JavaScript.

Google will penalize a site for hiding keyword rich text that cannot be viewed by users. They call the practice cloaking: showing content to search engine bots, but not to users.

Note that hiding text that can be shown via user interaction will not be penalized. There are many legitimate reasons to hide text initially but show it when the user needs it. Popular interactive devices such as carousels, light boxes, and fly outs need to initially hide some content.

When text is initially hidden, but can be viewed by users through interaction, Google may choose not to index the words in that text. If it does index them, it may give them less relevance weight than words shown to users on load.

In the last few years as Googlebot has gained the ability render pages, Google has changed its guidelines regarding AJAX. It used to be that if you wanted a crawlable AJAX website you would have to implement "hash bang" URLs with HTML snapshots. Now Google can crawl AJAX websites that implement "push state" for changing URLs as the content on the page changes. Push state is much easier to implement than HTML snapshots because it doesn't require server side HTML production that mimics the client side JavaScript.

Even though Google can now crawl AJAX pretty well, if you want an AJAX site well indexed, you have to provide a different URL for every piece of content. Single page applications where the URL never changes are still not SEO friendly because Google has no way of deep linking into the content that matches searches.

  • What if the JavaScript/CSS files are blocked in robots.txt? Googlebot wouldn’t be allowed to crawl them and couldn’t notice that CSS/JS is used to hide content, right?
    – unor
    Oct 5, 2016 at 17:31
  • Google asks that you not put CSS/JS into robots.txt because they now render pages with Googlebot. It isn't just to catch CSS cloaking, they do so to boost mobile friendly sites. If you do block Googlebot from crawling your CSS/JS your site may not rank as well. You might be able to avoid an algorithmic cloaking penalty, but you still risk a cloaking penalty from a manual review. Oct 5, 2016 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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