How to Allow Google to Crawl Your AJAX Content

How to Allow Google to Crawl Your AJAX Content thumbnail
You can modify your server so that Google can crawl AJAX-enabled Web pages.

When your Web page features AJAX-enriched content, it's important to properly set up your server so that Google can crawl and index your content. You can use AJAX alongside HTML to help create dynamic Web pages. Unfortunately, Google struggles to crawl AJAX Web pages; therefore, you need to make a few changes, such as URL formatting and providing Google with HTML snapshots, so that your Web pages will appear on the Google search results.

Instructions

    • 1

      Change all occurrences of "#" to "#!" in the AJAX Web page URLs you want Google to crawl. For example, "www.myserver.com/page.html#user=name" becomes "www.myserver.com/page.html#!user=name."

    • 2

      Modify your server so that it processes URLs with "?_escaped_fragment_=" in them to map to an HTML snapshot of the corresponding "#!" Web page. An HTML snapshot contains all the Web page's content that shows up after any JavaScript is done executing. A headless browser such as HtmlUnit can retrieve HTML snapshots for you. Make sure the URL is unescaped with standard URL decoding so that "%XX" characters such as %20 become a space. For example, the URL "www.myserver.com/page.html?_escaped_fragment_user=name" gives an HTML snapshot for the Web page found at "www.myserver.com/page.html#!user=name."

    • 3

      Include the following meta tag in the "<head>" section of the HTML for any dynamic AJAX Web pages you want Google to crawl that don't contain a "#" character in the URL:

      <meta name="fragment" content="!">

      This tells the crawler to load the "_escaped_fragment_" version of the URL.

    • 4

      Test if your site is working properly by using the "Fetch as Googlebot" tool.

Related Searches:

References

  • Photo Credit Patrik Stollarz/Getty Images News/Getty Images

Comments

Related Ads

Featured