Solved

Including header files in HTML pages

Posted on 2014-03-04
4
213 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now