WebReference.com - Chapter 21 of Professional JavaScript, 2nd Ed., from Wrox Press Ltd | WebReference

WebReference.com - Chapter 21 of Professional JavaScript, 2nd Ed., from Wrox Press Ltd

Professional JavaScript 2nd Edition

Professional JavaScript Book Cover

Chapter 21: The BBC News Online Ticker*

The series of excerpts below are from Chapter 21 of the Wrox Press Ltd. title Professional JavaScript, 2nd Edition.

In this chapter, we are going to review an application of JavaScript in the creation of a news ticker. This is the one used on the front page of the BBC News Online web site at http://www.bbc.co.uk/news. Here is a screenshot showing the ticker at the top of the middle column:

BBC Online Ticker Screen Shot

This was originally designed and implemented in 1999 at a time when the installed base of browsers was somewhat different to what is available now. When it was being developed, certain design choices were made, which now need to be readdressed given the progress that has been made since then. When the ticker was first implemented, these were considered to be the important criteria:

From the viewpoint of 2001, we now need to reevaluate those objectives and consider some changes to the original design criteria:

The early part of this chapter, will describe how the ticker works, its internals, and why it was implemented the way it was. It is necessary to discuss the compromises you need to make when building a real world JavaScript application like this.

At the outset, you begin with a somewhat ideal implementation that works fine on a single platform and browser. As you test the code on more platforms and browser versions, you gradually reveal more deficiencies in the browsers, meaning that you need to modify code until it works on both old and new browsers and whatever platforms that browser is supported by. In the end, you arrive at a code base that is somewhat less pretty than that which you started with. Also, there are all sorts of extra code fragments and sub-optimal coding techniques that become necessary.

That's roughly where we are with the live deployed ticker as it is on the News Online site. It works on the platforms and browsers it was originally intended for, but new browsers are available which mandate some corrective code to enable the ticker to run on them as well.

Things have moved on and usage statistics tell us that Netscape 4.x usage is still declining, while Netscape 6 usage is very small, but increasing. It is not yet a serious challenger to Microsoft, but it has the potential to gain significant market share. Opera browser usage is also small, but increasing, indicating that some people are considering alternatives to the Microsoft browser. We have a long way to go however before IE is no longer the dominant force in browser usage.

In the latter parts of this chapter, rather than simply review the ticker application as it was designed in 1999, we'll try to bring it up to date by remodeling the basic implementation so that it works with a wider variety of contemporary browsers.

Excerpt Contents

# # #

Created: November 5, 2001
Revised: November 8, 2001

URL: http://webreference.com/programming/javascript/professional/chap21/