Building an AJAX Application: Client-side Include
(By Mark Qian on 8/14/2006)
Preface
Client-side Include or Html Include is an operation that adds pieces of desired/shared html to the
target page(s), at render time in the browser instead of on the server. It is useful when you don't
have or don't want to use Server-side Include. One huge advantage of Client-side Include is
that it is cached in the client side while server-side include is hardly cached. This could be a
significant contribution to the scalability.
There are a variety of
(SolutionsShow details):
- AJAX
XMLHttpRequest is used in this approach.
Limitations:
- Javascript support is required
- "The Same oirgin" rule is applied
Here are a variety of implementation:
1. Mark's implementation.
In this example, an "anchor" script section (with id="__include__" below) is used to mark the
position to insert and the "anchor" is removed after the
insertion. This page is one of pages using Mark's implementation: the included parted included
resides at the bottom below this blue area.
2. An approach at Boutell.com: Codes.
(Source CodesShow details):
|