Re: How to include HTML code from an external file

by Andrew McFarland <aamcf(at)aamcf.co.uk>

 Date:  Wed, 16 Jan 2002 22:14:57 +0000
 To:  <hwg-basics(at)hwg.org>
 In-Reply-To: 
  todo: View Thread, Original
At 13:39 16/01/02 -0500, George Tsang wrote:
>If I can use the <script> tag to bring in JavaScript code from an external
>file (e.g. whatever.js), and the <link> tag to bring in CSS code from a file
>with a name like whatever.css, is there a way to bring in HTML code from an
>external file as well? I tried to use <script> and <link> without success.

Quick answers. If you can use SSI use SSI. Its a more reliable system - 
everything is done on the server before it reaches the browser. If you 
can't use SSI, then use an external JavaScript file with a document.write().

The primary disadvantage of using JavaScript is not everyone has a 
JavaScript enabled browser (I regularly use a modern browser on a new 
computer that doesn't support JavaScript). A secondary disadvantage is most 
(all?) search engines don't read the text inside external JavaScript files.

You can also do this sort of thing for static pages using a system like 
Template Toolkit. Must do a tutorial on that sometime. You could also try 
inline frames, but I've no experience with them (they are probably less 
widely supported than JavaScript).

Andrew

--
http://aamcf.co.uk/

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA