Google Code It didn't take long for WordPress plugin authors to take advantage of the recently released AJAX Libraries API from Google. I've found two plugins so far: "Google AJAX Libraries API Plugin" from clearskys.net and "WordPress Plugin: Google AJAX Libraries API" from lud.icro.us. I chose the former, of course, because the latter is just plain LUDICROUS. I'm joking, of course. Either plugin will probably work as well as the other.


Use this plugin!

Every time you visit a website, all of the elements of that website have to be downloaded at least once. External CSS and JavaScript files are cached by your browser. This is what makes navigating through additional pages at a particular website faster than loading the initial page.

The problem with this caching method is that it has to happen for every website you visit because the URLs that point to the scripts are always different. The Google API will solve that problem. I'll give you an example based on my browsing habits.

Let's say I go to "Asian Ramblings" to read Steve's latest attempts at wit and wisdom and he uses the Google API plugin. After I'm done, I decide to head over to "More Than Scratch the Surface" to see if Stephen has a new WordPress plugin to try out and he also uses the Google API plugin. The first page load Stephen's blog is going to be faster than it would be without the plugin because my browser has already cached the JavaScript from the same source URL.

Let's say I then go to check out JD's shiny new header image at "I Do Things So You Don't Have To" and she doesn't use the plugin. It's going to seem as slow as molasses compared to the other blogs I visited. And what happens when I visit at Lin at "Telling It Like It Is" to read her article about the Six Flags Over Georgia decapitation article and she doesn't use the plugin either? Another slow loading page compared to what it could be.

The Caveat

The only problem with using Google's API is what if it stops working? Neither of the plugins I mentioned actually replaces the code used by your WordPress installation. They just tell it go fetch the code from someplace else. If you deactivate the plugin, your installation returns to its previous state.

I don't see it as a real problem right now. In fact, I think it's going to save a whole lot of time and bandwidth for most of us in the long run. Someone mentioned, somewhere, that if could halt the page like AdSense ads do from time to time. Well, if you're displaying AdSense ads then you wouldn't know the difference, would you? I actually haven't seen AdSense ads halt the display of a page for long, long time — probably more than a year. (Perhaps it's one of the reasons Google bought all that dark fiber?)

Privacy Concerns

I've also seen this mentioned in more than one place. The headers from your site are passed to Google through one or more of the script and Google can track browsing habits with it.

Let's get real. A lot of people are using Google Analytics which collects the same information. If you use Google's Webmaster Tools, some of that information is there as well. In other words, Google gets that information from multiple sources so this privacy concern is no more an issue than the others.

Questions

If you have questions, I don't really have any answers. I'm using the first plugin I mentioned right now. I also optimized some other things on the blog which I haven't mentioned yet, but suffice it say that AdSense and WordPress caching don't get along in the way I display AdSense. I had to do other things to speed things up a bit.

(Update 1: It appears that Ajax Edit Comments stopped working. I don't know if it's a conflict or Firefox 3 — I have another plugin that doesn't work with Fx 3 — I disabled it and will reenable it if the browser is the only problem.)

(Update 2: It turns out that I had to change 1.2.6/jsquery.min.js to 1.2.3/jsquery.js in the plugin to maintain compatibility with AEC.)