Monday 28 September 2009

3.9. Client side programming

Working as professional software developer includes a lot of programming; one could assume that I would be bored of developing such a basic client application. But my work mainly involves middle-tier and back-end database programming so I took the time to develop something that uses some of the techniques described on this blog with a view to enhance my understanding of the DOM model and other front-end technologies.

I was indented to use the meta information of BBC pages with regards of which urls to display, but I’ve stumbled across the same-origin-policy which prevents JavaScript to access pages on different sites. So the choice was to hold the urls within the application, which was developed in two faces.

- Initially the user selection was filtered by using pre-populated select html elements, with onchange() events attached to display the appropriate url on the page. This is still happening, but with a few modifications and additions described below.

- When Session 08 described the way modern search engines work, regarding inverted files etc, I’ve consider it a better challenge for me to try and emulate some of those. I certainly didn’t expect to face so many peculiar challenges imposed by current modern browsers such as:

  • The use of XML data source for the drop-down lists and to create a basic emulation of the IR techniques. Faced with the challenge of different ways an xml document is loaded by different browsers. Mozilla and recent versions of IE uses the XMLHttpRequest() object, though older IE versions use the ActiveXObject("Microsoft.XMLHTTP")  approach (w3schools).
  • The use of XPath to extract XML element and attributes values greatly simplified traversing the XMLs, however there were cross-browser issues related to how the XPath expressions are used. Thus i've implement cross-browser functionality, based on recomendations by w3schools.
More info about the application inside the commented code. This is the result:
http://www.student.city.ac.uk/~abhp626/BBCinfo.html

No comments:

Post a Comment