Beyond the Browser – JavaScript in rich applications

Friday, June 23rd, 2006 at 11:00 am

JavaScript is not only used in browsers – many applications start supporting it as a means to extend and script for them – the new Yahoo! Messenger 8 being one of them.

When I first learnt JavaScript I was thrilled by the development opportunities it offered me.

I was able to make things

  • change the look and feel when the user interacted with them
  • show and hide parts of a form to make it less daunting to use and
  • to give a user interface more interaction logic than just page reloads.

The only trouble I had was that my cool code only worked inside a browser – and not all the people I wanted to show that had the right ones at the time or were online (this was 1997).

The benefit of development for browsers is that your products are easily distributed, available world wide without much hassle and can be updated in one central location. The biggest obstacle for the aspiring scripter is that you cannot rely on JavaScript being available and that you have no means of knowing what browser is used at the receiving end. This, and security constraints of browsers which became necessary because of viruses and spamming / phishing attacks makes even today web development one of the most complex and confusing jobs.

When JavaScript turned bad

When the big .com bubble burst around 2000 a lot of developers gave up on JavaScript as we had used it for frivolous bells and whistles rather than enhancing user experiences. It felt that we had accumulated expert knowledge in languages and techniques that might be obsolete soon. Many people I know that went into Java, C# or other thick client development argued for years with me that I will simply not make and retain a living by just knowing HTML, CSS and JavaScript (I do know more, but that is another issue).

All fair points, and something to think about; however, these web technologies have one massive benefit – they are dead easy to learn.

Web development reloaded

The really great change that happened over the last few years (apart from Ajax making JavaScript hip again) is that vendors of larger software packages have recognized this low learning curve as an opportunity and started supporting HTML, CSS and JavaScript as means of improving or adding own components to their products. A lot of developer IDEs can be extended with own scripts (my Homesite is full of them ), many applications allow for skins in CSS and HTML and even heavyweight applications like Illustrator or Photoshop allow you to use JavaScript to make them interact with each other or even create imagery .

Mac OS X Tiger 10.4 users can write Dashboard widgets – small applications that users can add to their operating system to talk to web services or alert them of incoming messages and mail (If you’re on Mac
OS X Panther 10.3.9 there’s a third-party tool you can use to run widgets as
well) . For Windows users there are Microsoft Gadgets which will become even more powerful in Windows Vista. For both Mac and and Windows there is Konfabulator which is now Yahoo! Widgets that allow for the same easy and quick development. The amount of Widgets in the Yahoo! gallery shows how many developers started to embrace the idea of using traditional web development technologies outside the browser.

Yahoo! now started to open up another one of their products for these developers: the Yahoo! Messenger. By downloading a simple SDK that comes with a complete documentation you can add an own plug-in to Yahoo! Messenger which displays below your contact list. There are two types of plug-ins:

  • Personal Plug-Ins which display content within the Yahoo! Messenger windows and allow you to add any of the web content you have – your bookmarks, your photos, text content (RSS feeds) from different sources or even allow you to do searches or display content related to your contacts.
  • Conversation Plug-Ins which help you to interact with your online contacts in other ways than the ones that come out-of-the-box.

Your Plug-In can be as easy as a simple HTML file, an HTML document enhanced with JavaScript or even an own Active-X control (a flash movie for example). The SDK contains instructions where to put your files and how to use the API (Application Programming Interface) to read out almost any setting of the messenger, the names and status of your contacts, set your own status, send messages, initiate file transfers, load data from the web via HTTP (which is like an Ajax call in a web site) and many other things. Your functionality can remain inside the messenger or you can open a secondary window to allow for more content to be displayed. Once you have created your plug-in you can either keep it to yourself or your friends or you can send it in to Yahoo! for testing (as they obviously don’t want to advertise plug-ins that may be security risk) and publication in the Messenger Plug-in Gallery where other users can download and rank it.

Why bother?

You may ask now why you should bother adding a plug-in to your messenger when you could just display third party content and RSS feeds in a browser (I myself am a big netvibes.com fan). The answer is that it might be easier for you to use, when you have a lot of contacts in your Messenger anyways – for example how many times did you get a message and copied and pasted a URL in your browser? You could write a plug-in that allows your contacts to send you a URL that will be displayed in your messenger immediately without having to open another tab or window. It also makes it easier to write self-refreshing documents that pull new information every x minutes without having to reload a browser window – like some web services or modern webmail clients do – but without the slowing down your browser or flooding the error console of your browser. Personally, I tend to crash my browser a lot when developing, or have that many tabs open that I’d rather quickly check my messenger for changes in my flickr comments, new bookmarks on delicious or even my web site stats.

So, if it is that easy – what have you done?

If you now wonder why I am writing about this (no I do not get paid extra money for it) and what I have used the plug-in SDK for so far, I am proud to tell you that if you downloaded the new Messenger 8 from Yahoo! you have a bit of my work on your computer already: The Yahoo! Answers Plug-In that comes with the install was my first task when I joined in April.

Share on Twitter