Solutions for Ajax Pitfalls
Problems and Solutions for Ajax Development
Like anything else, Ajax has some pitfalls that developers should understand. The first issue concerns visual feedback because Ajax requests via XMLHttpRequest do not provide any feedback. To clarify, when someone clicks on a traditional hyperlink, the browser provides feedback indicating that the content of the link is being loaded. The user knows the browser is working on the request but with Ajax, such feedback is not provided. The quick fix to this issue is to use some sort of animation to show that visual feedback; most of the time it’s a simple “loading” animation that is displayed while the user waits for the XMLHttpRequest response.
The second issue is about URLs because Ajax applications display new content with the same URL in the location bar. Traditionally, whenever a user loads a new page, each page has a unique URL. So, it’s impossible for a user to bookmark a particular page in an Ajax application or even cut and paste a URL from the browser’s location bar. One solution for this issue is to include a “link to this page” link on every page of your Ajax application. This fix has been implemented by Google in their Google Maps application and it highlights the importance of allowing users to see and bookmark every URL.
Another issue with Ajax is the BACK button which will back the browser all the way out of the Ajax application rather than just moving back to the mostly recently loaded page. This occurs because XMLHttpRequests bypass the browser’s history mechanism and the “back” and “forward” buttons that people often use to navigate websites are useless. The appropriate solution for this issue is to think about the design of the Ajax application and make sure that elements that perform scripted HTTP do not look like hyperlinks. Elements that look like hyperlinks should do real page reloads. Such design will not confuse a modern user from an inappropriate use of a “back” button. In Google Maps, when a user clicks and drags to scroll a map, he or she does not expect to undo the scrolling with the “back” button. If an application has buttons like Next and Previous, it should use traditional loads to display the next or previous screen because in this case a user would expect to use the “back” button.
There are more issues, like printing problems, certain browser’s ajax incompatibility, and ads inside the application not being reloaded. If a browser has JavaScript disabled, providing a non-AJAX alternative may require a lot of extra work. Ajax also has problems with Search Engine Optimization, Accessibility, and Analytics. It may be hard for spiders to properly index content of a website that is returned through AJAX. Heavy Ajax use can also complicate screen readers or other programs used by those with visual impairments. As far as analytics or tracking is concerned, asynchronous JavaScript calls add complexity to capturing analytical data. Overall, I still think that AJAX is amazing but those who use it need to be aware of its flaws. For more information, check out Ajax Mistakes.
Popularity: 13%
If you enjoyed this post, please consider to leave a comment.












Comments
No comments yet.
Leave a comment