Trisha Shetty (Editor)

Hijax

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

Hijax is a term for the application of progressive enhancement to AJAX. It is also known as 'Simplified Ajax'. Hijax was proposed by Jeremy Keith as a technique for building web applications that degrade gracefully by only using AJAX techniques to 'hijack' form submissions and responses, updating the DOM to reflect the results of the request/response cycle.

Contents

Development history

Ajax has truly revolutionized the web by creating a far better user experience. Gone are the days with long waiting for complete page loads during switching from one page to another. With Ajax only the target content is updated with less time, consumes less server-side resources, and reduces bandwidth loads drastically. However it was incapable of remembering the user's history and bookmarking as Ajax made no changes to the URL. Then came the URL hashing concept and the problem could be solved. But another important issue remained: web crawlers find it difficult to crawl into Ajax-based websites and hence became SEO unfriendly. Google implemented the concept of 'hashbang' to solve this problem too. (Exclamation sign (!) is used just after hash symbol (#) like in www.example.com/#!newcontent). But still not every search engine have adopted this, so AJAX is still a challenge for search engine optimization (SEO).

Problems like these could be solved using new techniques but the biggest problem faced by AJAX applications is its backward compatibility. For devices that do not support JavaScript, or simply has this functionality disabled, or that doesn't support XMLHttpRequest (XHR), Ajax is not just useless but also a huge problem as the content is not accessible. For this reason AJAX has faced many criticisms like "...it must degrade well. It must still be accessible. It must be usable. If not, it is a cool useless piece of rubbish for some or many people."

What is hijaxing

Without Ajax, normal hyperlinks and form submissions make the web browser load a new web page in its entirety. With Ajax, only a target page element gets updated, and, except for the hash segment of the URL, everything else is untouched. However, Ajax sites have often run into SEO and accessibility difficulties, as this interchangeable content is often hidden from search engine crawling and not obtainable by users if their browsers do not support Javascript fully.

Hijax is a hybrid development technique meant to address Ajax's accessibility and SEO shortcomings. It encourages developers to plan for Ajax from the beginning, but only implement it at the end of a project, forcing them to build a site that is functional and accessible without Javascript techniques. Ajax is then added in ways that enhance the site experience for browsers that support Javascript while not isolating content from users and search engines that do not have this luxury. In other words, it is progressive enhancement theory applied to Ajax; one starts with just basic content, and adds better functionality for browsers that support it without breaking the site for those that do not.

For example, a site has a hyperlink. With Javascript enabled, Ajax is used to "hijack" the link's default behavior when clicked - where Hijax gets its name - and loads a small amount of new page content. Without Javascript enabled, it will load a full new page, a graceful degradation. With Ajax, the browser's loading signs will be observable and the URL will update, but only certain page elements will have changed.

Good hijaxing encourages the use of a modular back-end architecture via APIs.

References

Hijax Wikipedia