Solved

Including header files in HTML pages

Posted on 2014-03-04
4
216 Views
Last Modified: 2014-03-05
Including header and footer files in ASP was very easy.

But how do I achieve it in a pure HTML page?
0
Comment
Question by:RTKHOT
  • 2
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39905720
You can't.  'pure' HTML does not have a command to do that.  Something other than HTML is always required to do that.
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 200 total points
ID: 39905732
Dave, can you turn on serverside includes?

Otherwise, you could do this in js or jquery. I prefer using jquery..
<script>
$(function() {
$.ajax({
  url: "myHeader.html",
  cache: false
})
  .done(function( html ) {
    $( "#header" ).append( html );
  });
 });
</script>
<div id="header"></div>

Open in new window

0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39905751
Dave, can you turn on serverside includes?
Yes but that is still not 'pure' HTML.
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 39905793
HTML inside "includes" need some server side technology way to insert. You can also think of IFRAME way.
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question