W3C home > Mailing lists > Public > www-html@w3.org > December 2001

subject=re: client side includes&in-reply-to=<004d01c087e9$34cdb4c0$188419d4@florida>&references=<004d01c087e9$34cdb4c0$188419d4@florida>

From: Avi Naparstek <avinap@mail.com>
Date: Sun, 9 Dec 2001 18:27:17 -0500 (EST)
Message-ID: <01C18119.3F891B00@diup-0-23.inter.net.il>
To: "'www-html@w3.org'" <www-html@w3.org>
Sorry to butt-in late (almost a year late..) on a party, but I might as well:

I've been looking around for something around the lines of this for a while (a lean, clean way of including URL-Based content into inline  HTML) and found zilch.
My own considerations included:
1. reducing server-side load for reusable code-segments. This is of-course especially relevent when we have complex server-side scripts that generate a finally reusable HTML segment (say, a DB-Generated segment), and yet cannot be pre-rendered  (I know this one was a bit far-fetched).
2. Reducing bandwidth usage in large reusale HTML segments (such as long navigation-bars, long <select> option-lists and in general any comlex form which might be reusable, such as search-engine interface-forms)
You can see, both considerations don't explicitly call for CSIs, but rather for a smart caching method for HTML segments, without breaking up my pages into <IFRAME>s.

So here it is (I guess I'm in a serious lack of self-esteem these days):

Considerations and limitations:
My solution is ASP-based, and incorporates using the MSXMLHTTP object on the client-side.
I know it's proprietry (and not very popular), but for us just-make-the-damn-machine-work-after-I-invested-thousands-on-the-Microsoft-package people, it's clean and simple.
The whole solution relies on the builtin caching of our client-side browser, so any cache limitations set up in the browser-options will take effect here.
Also it is important to note that within files constituting CSIs, there should be a set content-expiration limit so your client WILL SOMETIME IN THE FUTURE get to reload the dynamic-yet-cached content of your CSI.

The solution comprises of a client-side Javascrip function called CSInclude(url), which subsequently fetches the appropriate URL and inserts it in place where the function call was placed.

Ta da:

function CSInclude(URL){
	var xmlHTTP= new ActiveXObject("Microsoft.XMLHTTP");

// Increment semaphore

// Get stuff

Sample code:
<!------  Define the CSInclude() function. This can be done inline or via a <script src=...> approach    --------->
	<script language=Javascript>
	function CSInclude(url){
The following is a client-side include:
<script language=Javascript> CSInclude("http://www.mySite.com/myCSI/myFile.asp"); </script>



 - Party pooper Avi.
Received on Monday, 17 December 2001 10:19:02 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:58 UTC