2

I want to include the same header html in many pages in subdirectories. I'd like not to copy that header file. In the example code below the header file is in both the current and parent directories.

A relative path to the file seems not to work, although a relative path to the javascript source is just fine.

(If I have asked an x-y question and there's a better strategy from the start, please enlighten me.)

<!-- this works:-->
<div w3-include-html="header.html"></div>
<!-- this fails-->
<!-- <div w3-include-html="../header.html"></div>-->

<script src="../w3-include-HTML.js"></script>
Community
  • 1
  • 1
Ethan Bolker
  • 217
  • 1
  • 6
  • 18
  • click [here](http://stackoverflow.com/questions/418503/common-header-footer-with-static-html). May be this can resolve your issue. – rohit kumar May 04 '16 at 05:52
  • @rohitkumar I used the ,javascript answer there. Post your comment as an answer and I'll edit (since link only answers are frowned on) it and accept it. – Ethan Bolker May 06 '16 at 23:38

1 Answers1

0

It is using the relevant path from the w3-include-HTML.js it is why the first example works but not the second.

Regardless of where the page is, you should only have to use the first example.

Adam Buchanan Smith
  • 9,207
  • 5
  • 15
  • 37