We help IT Professionals succeed at work.

Include Header & Footer


Is there a way for me to include a Header.htm & Footer.htm file into another HTML (i.e. Home.htm) ?

What is the syntax which i can use to do so?
pls advise.


Watch Question

Yes, but you need some sort of server-side programming to allow this.

The ASP version is simply to include this line for each piece of included source:

<!-- #Include File="includedfilename.inc" /-->

As I mentioned though, this will only work with pages that have the .asp suffix.

There are quite a few other pages on this subject on EE, might be worth doing a search?

Top Expert 2013
The best and easiest way to do what you want to do is to use SSI (Server
Side Includes).  However yur serve must be configured to use them.  
Everything you need is here:


A client-side only option, whic is more work is to dynamically generate
the header and footer using JavaScript in a .js file that is pulled in
as the src in a script tag.


This will work in IE only:


<SCRIPT language='JavaScript'>

function include(url)  // must be a fully qualified URL, I don't know why.
   var xml = new ActiveXObject("Microsoft.XMLHTTP");
   xml.Open( "GET", url, false );



<SCRIPT language='JavaScript'>

Body of page goes here.

<SCRIPT language='JavaScript'>




hi all,

thanks for all your comments/answers
i will try that out and post the outcome later

knightEknight, is there a way to get it work for at least both Netscape and IE browser? i need to make it as browser independant as possible.

If you want browser independace then JavaScript isn't the way to go, SSI, an include in another server side language (PHP, ASP, etc) or an HTML preprocessor are entirely browser independant.

The only way to make it browser independent is to go with some type of server-side includes.  However, your question specified including one .htm file inside another .htm file.  If by this you meant no server involvmemt, then HTML and JavaScript is the only way, and for now this only works in IE.  But since you require NetScape compatibility, I suggest that you look at the link provided by CobolDinosaur (above) on SSI.  You will need a webserver, and you will need to configure it to allow SSI in .htm files.
if you download a trial version or if you have dreamweaver this might help
DreamWeaver Has a great feature called assets
you can save multiple files in .lbi format and include them in html documents and they work for both IE and Netscape
this is how it works make a directory named library in your root folder
then save the html file that you want to include in another html file as .lbi
save it in the library folder then  open dreamweaver go to the windows tab and click on library
the lbi file will come up and you can insert it on any document you have open in dreamweaver
the code looks something like this

<!-- #BeginLibraryItem "/library/index_pusd_header.lbi" --><table border="0" cellpadding="0" cellspacing="0" width="750">
   <td>Hello this is a weird way to include files</td></tr>
</table><!-- #EndLibraryItem -->

the cool thing about this option is that you dont need a server or coding experience to include

else go with

<!-- #Include File="filename.asp" /-->


Thank you all for your help and advises.

I'll try your suggestions once i have the time.
Thanks alot!
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> You cannot delete a question with comments, special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process for further information, if needed.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.  Anytime you have questions which are LOCKED with a Proposed Answer but does not serve your needs, please reject it and add comments as to why.  In addition, when you do grade the question, if the grade is less than an A, please add a comment as to why.  This helps all involved, as well as future persons who may access this item in the future to seek help.

To view your open questions, please click the following link(s) and keep them all current with updates.

------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643

Moderators will finalize this question if still open in 7 days, by either moving this to the PAQ (Previously Asked Questions) at zero points, deleting it or awarding expert(s) when recommendations are made, or an independent determination can be made.  Expert input is always appreciated to determine the fair outcome.
Thank you everyone.
Moderator @ Experts Exchange
Top Expert 2013

This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

Top Expert 2013

It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

points to COBOLdinosaur


If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Finalized today.
Moondancer - EE Moderator
Top Expert 2013

Thanks Moon. :^)


Explore More ContentExplore courses, solutions, and other research materials related to this topic.