One of the major problems of Ajax is that search engines can not recognize JavaScript, so any contents that appear in your page using Ajax are not indexed. This article shows an easy solution to work-around this problem.
Suppose that you want to make a JavaScript event onclick to open a new layer in your page (eg. Index.html) that retrieves a page from your server using Ajax request.
Steps:
- Create the page that your ajax code requests for example “page1.php”
- In index.php in the link update the onclick with your ajax event (onclick=”showpage(’page1.php’); return false;”.
- Type the url in the href = “page1.php”
The code in href is used only by the search engine crawler and the onclick will be used by normal browser so your contents are all indexed..
Important Note:
Make a server side redirection from page1.php to index.php if page1.php is requested directly not from ajax request.