Question: I want to create common header and footer pages that are included on several html pages. 

I'd like to use javascript. Is there a way to do this using only html and JavaScript?

I want to load a header and footer page within another html page.

Answer: 
You can accomplish this with [jquery](http://api.jquery.com/load/). 

Place this code in `index.html`

```
<html>
<head>
<title></title>
<script
    src="https://code.jquery.com/jquery-3.3.1.js"
    integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
    crossorigin="anonymous">
</script>
<script> 
$(function(){
  $("#header").load("header.html"); 
  $("#footer").load("footer.html"); 
});
</script> 
</head>
<body>
<div id="header"></div>
<!--Remaining section-->
<div id="footer"></div>
</body>
</html>

```

and put this code in `header.html` and `footer.html`, at the same location as `index.html`

```
<a href="http://www.google.com">click here for google</a>

```

Now, when you visit `index.html`, you should be able to click the link tags.
Aloha from 2018. Unfortunately, I don't have anything cool or futuristic to share with you. 

I did however want to point out to those who have commented that the jQuery `load()` method isn't working in the present are probably trying to use the method with local files without running a local web server. Doing so will throw the above mentioned "cross origin" error, which specifies that cross origin requests such as that made by the load method are only supported for protocol schemes like `http`, `data`, or `https`. (I'm assuming that you're not making an actual cross-origin request, i.e the header.html file is actually on the same domain as the page you're requesting it from)

So, if the accepted answer above isn't working for you, please make sure you're running a web server. The quickest and simplest way to do that if you're in a rush (and using a Mac, which has Python pre-installed) would be to spin up a simple Python http server. You can see how easy it is to do that [here](https://www.youtube.com/watch?v=lE6Y6M9xPLw).

I hope this helps!