AJAX Comments Test

The comments on this post are loaded asynchronously with an XHR (known to laymen as “AJAX”) from the server. This makes the initial HTTP GET for the page much faster, and delivers a better user experience for pages with large numbers of comments.

If you use a newer browser (like Safari, Chrome, or Firefox 4), when you click on the previous/next comment navigation links those comments will also be fetched using an XHR. The rest of the page, which doesn’t change, doesn’t have to be downloaded again. Look at the URL as you change pages — it updates to reflect the page you’re viewing! After navigating through comments pages asynchronously, try using the “Back” button on your browser. You will have distinct history states for each comments page, using new HTML 5 window.history.pushState(), window.history.replaceState() and window.onpopstate functionality.

No changes have been made to this theme or to the WordPress core. This plugin functions entirely by using the WordPress hooks system, and it should work with any theme that uses the standard comments template functions.

Without this plugin active, this page’s HTTP GET (uncompressed) is approximately 186.3 KB. With the plugin active, it is approximately 10.8 KB.

The onload event for this page fires 2x faster. The HTML is generated by the server 6x faster. The HTML downloads 3x faster.

This entry was posted in Uncategorized. Bookmark the permalink.