JSON and the Ajaxnauts

September 5, 2008

In a world of BBC News and broadcast media I’ve had a thrilling romp playing with Flex, JSON (and the Ajaxnauts) and revisited JavaScript. I’d forgotten what an awesome language it is when used properly.

Closures particularly are one of its most awesomely powerful features. Once properly understood they tend to roll off the keyboard almost by accident. It makes you wonder how you ever wrote software which doesn’t have them.

Much like my comments about C# thread syntax being easy to use and abuse without realising it, closures are easy to create, but have potentially harmful consequences for the unwary, particularly in IE. To avoid accidentally stepping on a closure landmine it is necessary to understand their mechanism. This depends largely on the role of scope chains in identifier resolution and so on the resolution of property names on objects.

Laurens van den Oever’s solution to stop you wetting yourself when programming for IE is a good one.  Incidentally, I needed a good XML to JSON converter and fairly randomly chose Thomas Frank’s to get me going. I intended to revisit this and write my own, but it’s been so good I shan’t bother – it’s been flawless.


Not so long ago, I wrote an article showing how to implement custom hyperlinks using asynchronous pluggable protocols. Even if you’re not familiar with APPs, you use them everyday on your PC. Every protocol, whether the more familiar http, ftp or less familiar JavaScript, res, news etc. is implemented on Windows PCs as an asynchronous pluggable protocol which plug directly into Windows’ existing protocol framework. One of the more obscure protocols is res: to view resources in a DLL in Internet Explorer.

MSDN fully describes how to implement custom protocols schemes using pluggable handlers. This allows developers to implement new schemes for IE and applications that use URL monikers. To fully implement a protocol requires a fair bit of work and is really focused on use in IE.

My particular requirement at the time was managing users expectations that custom hyperlinks could be used to integrate an application into the desktop using IE and the Office suite. IE would be pretty easy, but Office? However, as the article explains, it’s possible to hijack the regular hyperlink behavior and piggyback your own. Consequently you can use regular html anchor syntax to implement your own link behavior – in this case my very important protocol vip.

<a href="vip:some custom parameters here">My custom hyperlink</a>

Put this in a Word or Excel document, it’s displayed as a regular link and when the user clicks on it, your protocol handler catches it.

More recently, I was contacted by Eric Lawrence, the program manger of IE, informing me I’d made a mistake in calling this asynchronous pluggable protocols. I’d only really used a side effect of it. However, he did point out that what I had discovered was something called Application Protocols; something they use internally in the IE group.

Despite my smugness in discovering this, it was good to be corrected.