COWS Ajax - Ajax evolved

COWS Ajax takes over where Ajax leaves off. The web has gone through a great period of experimentation and now there is a dizzying array of frameworks, add-ons, how-toís, and books. The common element these Ajax aides all fail to overcome is that, even with aides, apps take a long time to create and debug. Many times someone has already created a great tool and youíd really just rather use theirs instead of reinventing the wheel (especially if itís a Google, Yahoo, or other trusted player). Wouldnít it be great to drop in a single-line of code to gain a huge amount of functionality that frees you for something else? You canít do that with Ajax, but you can with COWS (Changeable Origin Web Services) Ajax. Now highly interacticve third party services like SpellingCow are possible.

The classic Ajax example is to auto-complete the userís city/state after they enter their zip. Peachy... but how many developers have access to an up-to-date zip code databases? Wouldnít it be better for the US Post Office to create a tool that you could simply access from your web app/page? You should be able to drop in a single-line of code that handles zip lookups and frees you up to work on the meat of your app/site. This isnít possible with Ajax, and thatís where COWS Ajax takes over.

The first real-world COWS Ajax powered app is SpellingCow. Itís not sexy, itís a spell checker. But itís cool in that it allows you to spell check as-you-type. Perhaps youíd like to have spell checking on your page/app, but donít have the time to go create one. But now you can just use SpellingCow to handle all the processing, allowing the user to communicate with both your site and SpellingCow. Still not convinced? Check out the SpellingCow favelet and explain how youíd do that with Ajax! You canít! You can bring a COWS Ajax powered app with you to any site you visit!

Apps like SpellingCow simply are not possible with Ajax. The short story is that Ajax must adhere to the browser same-origin policy, meaning that the user can only talk back to your site, and no others. COWS Ajax is able to breakdown this barrier via a method known as dynamic script tags. Like Ajax, itís a method that has been around for a long time (and works in many browsers & versions). I actually independently discovered the method in the middle of 2006 since the approach has not received much prior attention. No one has really tapped into its full power, and really SpellingCow is just the tip of the iceberg. Thereís no telling what a Google or Yahoo could produce.

The beauty is that really anyone with a valuable resource can probably come up with a killer app. Thereís no reason why you, as a developer, could not create some fantastic service. Through COWS Ajax, you now have a viable method of distributing it with minimal effort. Folks simply add a one-liner to their page and they are able to fully utilize your service on their site and in conjunction with any other services they may be running. Not to mention the possibilities from creating a favelet. In return for offering a service, you could insert ads, accept subscriptions, or increase brand awareness (like a USPS logo in the previously mentioned example).

The COWS Ajax web site has an in-depth explanation of how it works so weíll explain here in general terms. As mentioned, dynamic script tags are the driving force behind it. Letís say you, as a site user, are connected to a page on xyz.com that is also using SpellingCow, the out-of-origin server you couldnít normally access via Ajax. Each time you need to talk to SpellingCow, you dynamically insert a