The DIV_SRC Tool

How to Start Using DIV_SRC

It's pretty simple to change an existing HTML page to use DIV_SRC:

  • Download a copy of the DIV_SRC tool from here. Extract the DIV_SRC.js JavaScript file and store it on your web server. It's about 14KB in size with comments and white space, and about 4.5KB without.
  • Include the DIV_SRC JavaScript file by placing this line in the header section of your HTML page:
    <script src="DIV_SRC.js" type="text/javascript"></script>
  • Extract each section of HTML that you want to separate out and store it as a separate file on the web server. You don't have to give it <head> or any other special tags; the new file only needs to contain the content that you removed from the original page. Give each of these files an .html file extension (for example, one.html) so that web servers, browsers and proxy and caching servers know how to handle them.
  • Wherever you want the excised content to appear, reference it thus: <div src="URI"></div> – for example, <div src="one.html"></div>.
  • Trigger the fetching of excised content by inserting the italicised text into the body tag of your page: <body onLoad="DIV_SRC.resolve()">

Notes:

  • DIV_SRC won't work in an HTML page that you open directly from your hard drive. It uses AJAX, which will only talk to a web server, and then only the one that delivered the original page. The base page and all the bits that you remove from it must reside on the same web server, in the same domain.
  • Although DIV_SRC does not require the subfiles that you extract from the original page to have <head> or any of the other usual page tags, and discards them if it finds them, you may want to supply them anyway so that the subfiles can be displayed as HTML pages in their own right. This is covered in the topic Bimodal Web Pages.

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