Disadvantages of using AJAX and now to avoid them.

There are many advantages to using AJAX, but few talk about the disadvantages. Below are a few drawbacks to AJAX and how to avoid them.

  • The use of AJAX interfaces can increases the number of requests to web servers and the database. This can lead to slow response times and timeouts. To resolve this if possible reduce the number of requests to the web server to a minimum. If you are unable to reduce the number of requests your only option are hardware upgrades to support the increased requests.
  • Pages created using successive AJAX requests have issues when the user tries to use the back button to return to a previous page. The reason why this happens is because AJAX requests do not automatically register themselves with the browser’s history. To get around this you can use Iframes to make changes in the browser’s history to change anchor portions of the URL.
  • As with browser’s history issues that are issues with users trying to bookmark a part of the page. If they go back to the bookmark it may start them back at the first page instead of where they bookmarked. There are ways around this. Most use URL fragment identifier to keep track of the page the user is on.
  • If you want your site crawled then you will want to have an alternate way to access your site because many web crawlers can not execute JavaScript.
  • With the growing popularity of mobile devices such as PDA, smart phones, and the iPhone, many do not have JavaScript enabled browsers. When you add in the users that leave JavaScript disabled you have a fair amount of users that can not navigate your site. The only resolution for this issue to use non-JavaScript ways to access your site.
  • Using AJAX to develop your site can open up security holes because of the increased number of requests generated. This one is easiest to correct but requires more time in the development stage. Validate all input from the user. If the data is going to touch the database in any way make sure that someone is not trying to use SQL injection or a duffer overrun attack. The below web comic illustrates the point perfectly.

Leave a comment