AJAX Broke The Web
Wednesday, January 19, 2011
AJAX broke the web.
It was 1999, and Microsoft had just created the XMLHTTP ActiveX control in Internet Explorer 5. It was a very small API, that allowed web applications to retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page without leaving it. Shortly after its inital implementation by Microsoft, it was adopted by Mozilla, Safari, Opera and other browsers as the XMLHttpRequest JavaScript object.
The problem that AJAX introduced to web applications, was state. Before AJAX, a user would click a link and be taken to that page, changing the “state” of the application/site. With AJAX, a user clicks a link, and the new page is loaded asynchronously. From the browsers point of view, the state hadn’t changed - but as far as the user was concerned, it had. Because the browser didn’t know the state had changed, the back/forward butons didn’t work as expected either. This broke everyones head.
AJAX broke a golden rule of the internet, that many people still do today, but in other ways, and I won’t go into here. If you give a link to a friend, the page they see - should be exactly the same as what you see. There are some exceptions to this rule, but for the most part, it should be followed.
The last major problem it introduced was that when implementing AJAX into you web application, search engines could no longer crawl the pages. AJAX requires Javascript, the majority of search engine crawlers have no Javascript support, therefor, no crawling.
The solution that has worked fairly successfully so far, is to hack the “#” parameter (anchor) of the url. I won’t go into detail on how it worked, you can read more about it here. But in essence, it required changing the anchor of the page, and then monitoring it for change in Javascript. This method has always felt a little clunky to me, and I feel that we need a better solution.
The solution is now here, and its called the HTML5 History API. How does one use it? Stay tuned…

