Solved

Including header files in HTML pages

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

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 82

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

759 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

13 Experts available now in Live!

Get 1:1 Help Now