My improved website response with Ajax
I am an ajax-fan, in fact I watch every soccer match on TV. Ok, but that’s probably not what you want you are interested in
.
I really start wondering how to improve the response time after I concluded that it would be allot of work to convert this theme to a lightpress theme (I had to make a lot of plugins to get it to work).
So I started to think about other possibilities. The nice thing about lightpress was, it would only query the data in the database that was actually needed. So I tried to make an intelligent PHP frontend that only parses parts of the page that needs to change when you switch from page to page and gives it, wrapped in XML (because more than one part of the site need to change) to the JavaScript on the Client. The JavaScript on the client then parses the XML response and renders it in the DIVs on the website.
Needles to say, it saves a lot of bandwidth. My average page size did go from 15kb to 5kb (uncompressed, with ZLib compression, often not more than 1kb!). This has a lot of advantages, because it uses less processing and parsing time on the server and less download and render time on the client, and it looks nicer towards the user because the page doesn’t get refreshed. I The only overhead is the 4kb JavaScript, which is nothing compared to some other ajax JavaScript libraries.
Backwards compatible
Backwards compatibility was a key requirement for me. Since Google, MSN search, yahoo and other search spider bots don’t understand the the first thing about JavaScript or cookies. And, of course, the security nutheads (people that read security bulletins and don’t mitigate) that disables JavaScript because they think they are safer off. Ok I am going off topic, but think of it for a second. You are much, much, much better off (security and compatibility wise) by running Firefox of Opera as a limited user (right-click on the shortcut, run as), instead of disabling JavaScript in Internet Explorer!
JavaScript is responsible for turning the normal A HREF links to an ajax request in the background. This way it’s fully backwards compatible… Even if JavaScript works and even if the ajax request fails, It will switch to the old A HREF link.
Comments (4 comments)
[...] Advanced Ajax page loading see My improved website response with Ajax and Solved latency problems with Ajax [...]
Nico.Berlee.nl » Archives » AjaxBerlee WordPress theme released / October 17th, 2006, 2:55
[...] So far so good. An AJAXified page will initially display the AdSense advertise very well (because the pages are backwards compatible). The visitor clicks on a link and now only a part of the page get reloaded, but not the AdSense advertise.Because its possible to load an JavaScript into JavaScript, but its not possible to reload JavaScript into JavaScript (for scripts that aren’t build for it). [...]
Nico.Berlee.nl » Archives » AdSense and AJAX, not a happy combination / October 22nd, 2006, 22:10
excellent, go ahead
ser / July 4th, 2008, 22:15
excellent!!!
Simon / July 17th, 2008, 17:59
What do you think?