Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Including header files in HTML pages

Posted on 2014-03-04
4
Medium Priority
?
232 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 84

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 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 800 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 84

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
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…
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 …
Suggested Courses

885 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