The DIV_SRC Tool

Overview of the DIV_SRC Tool

The DIV_SRC tool provides web publishers with another way to deliver dynamic content to browsers. It is most appropriate when sections of a page remain unchanged over a period of time, perhaps moving from one place to another within the page. For example, news feed websites such as BBC News, CNN.com or Slashdot.org add new articles to their pages periodically, generally near the top. As they do so, older articles get pushed down the page, eventually migrating off the front page to "yesterday" or "archive" pages. Folk who visit websites like this one or more times a day are likely to see some articles several times over. Each time they visit, their browsers have to fetch the text of every one of these articles again. Given that much of the content may not have changed, just moved, this is a waste of time and bandwidth.

DIV_SRC allows web developers to divide HTML pages into a number of sections, which we can call "pagelets". These are removed from the base page, and each is stored as a separate small file on the originating web server. They are not a part of the base page; instead, they are included where needed in the base page by coding <div> tags with a src attribute added to them thus: <div src="URI"></div>.

The benefit that DIV_SRC can confer on news feed web sites is a potentially large reduction in the amount of dynamic content that must fetched from the web server that holds the original content, and hence a reduction in response times and bandwidth utilisation. There is a mock-up of a news feed in the demos section that shows a potential saving of over 90% in bandwidth utilization for the web server.

If this approach sounds strange, bear in mind that we have been doing it for images ever since they were introduced into web pages in the early 1990s, and we still do so today. We code <img src="URI"> for each image that we wish to include in a page. If the browser (or an upstream caching proxy server) already has a copy of the image in cache, it will use that instead of fetching a fresh copy from the originating web server. Similarly, we separate out style sheet definitions and JavaScript code into separate subfiles that are included by the base page, knowing that these subfiles tend to change much less often than does the base page, and that browsers and caching servers will keep copies of them, sparing the originating server from the burden of delivering them each time the base page is fetched. DIV_SRC allows us to use the same approach for text, tables, and most of the other content of web pages where appropriate.

DIV_SRC is coded in JavaScript and requires no server-side logic. A standard web server can be used to deliver the content.

If you're reading this text, your browser doesn't do AJAX (and maybe not even JavaScript) – see problems.

© Trevor Turton, http://turton.co.za, 2008-10-12