Hashbang

Does Google crawl AJAX content

How to make Google crawl your AJAX content?

 

User engagement through Ajax based content is the new mantra of today’s web development. Websites that use AJAX to load content are much quicker and provide a better user experience. But the problem of indexing Ajax based web content damages the SEO potential of your website.

 

Being a renowned SEO service provider, we have been dealing with various eCommerce sites that use Ajax for enhancing their usability. Doing SEO for such websites has been a tough job for us. But we have found a successful way out to deal with this problem. Today we will share our SEO experiences for Ajax based content.

 

Why search engine can’t crawl Ajax?

 

Ajax means Asynchronous Javascript and Xml. Web application using Ajax can send and retrieve data from server asynchronously without interfering the display and behavior of the existing page.

 

If you look at the url structure of such application you will notice that in most of the cases it remains same and sometimes followed by a # character with some parameter. So for search engines you are having a single url for all your web content through Ajax. Yet the problem doesn’t ends here. The contents your page is retrieving through Ajax, loads in a specific HTML attribute ( say <div id=”ajax”> –your content — </div> )

If you see the page source of our web page, you will find no content within this attribute except your default one. It’s because the process is asynchronous one. Thus it makes impossible for the algorithm or crawler to find your content and so it can’t be indexed of cached by any existing search engine including Google.
Hashbang
Though technically it is impossible to index Ajax based content but Google is the only search engine that has made a way out. Geeks call it Hashbang. A url bidirectional method between #! to escape_fragment. A live example can be seen in every Twitter url structure.

Let’s discuss how you can set up your hashbang url as an OnPage seo factor.

 

  • 1. Set up your ajax based content url structure as domain.com/ajax.php#!content1 where content1 is the ajax function parameter.
  • 2. Set up an addition page as domain.com/ajax.php?_escaped_fragment_=content1
  • 3. Make sure that both the url have same content. The first one is for the user and the second one is for the search engine.

 

How it works?

 

When Google finds any hashbang url structure, it understand that the page is serving an Ajax based content which can’t be readable. So it automatically makes a bidirectional transition and search for the content through a predefined key _escape_fragement along with the parameter as shown above.

 

If it can find any content over there then it assigns that content to your hashbang url structure. Thus you can have a different url along with content for every ajax based operation only if you like them to be indexed.

 

A detail report can be found in http://code.google.com/web/ajaxcrawling/docs/specification.html
Hope this will help you to make your ajax based application crawlable by Google.