-1

Ive a series of static html pages with a common footer, i want to inlcude content from the in each html file without duplication

e.g.

root
  page1.html
  page2.html
  page3.html
  footer.html

How do I make page 1,2 and 3 use the footer.html as the footer file without writing any java script. I've seen answers that included java script in this question How to include html file in another html file but I want to know if its possible without java script.

Remember

  • These are static pages not running on a server
  • This does not include the use of java script or other scripting process. - The answers to How to include html file in another html file all use javascript and do not answer this question.
Community
  • 1
  • 1
user1605665
  • 3,771
  • 10
  • 36
  • 54
  • 1
    The only way is to use a frameset (which is deprecated AFAIK): https://www.w3.org/TR/html401/present/frames.html . Today you'd use a build step to compose your page with a template system, e.g. https://jekyllrb.com/ . – Felix Kling Jun 13 '16 at 23:46
  • what framework/backend language are you using? – Wen Zhu Jun 14 '16 at 00:02
  • Perhaps look include [server side includes](http://httpd.apache.org/docs/current/mod/mod_include.html) – Ed Heal Jun 14 '16 at 00:03
  • @EdHeal - I'm unsure how you propose that this would help, given that the OP stated in the original question "These are static pages not running on a server". Is this an oblique way of suggesting that they should? (be running on a server) – enhzflep Jun 14 '16 at 08:44

2 Answers2

1

iframes are HTML, they are very similar to PHP includes, but have much more security restrictions given the nature of open client based HTML compared to secure server based PHP.

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <style>
      
      </style>
    </head>
  <body>
    <header>
      <h1>iframes</h1>
      </header>
    <main>
      <section>
        </section>
      </main>
    <footer>
      <iframe src="http://example.com"></iframe>
      <iframe src="http://example.com"></iframe>
      <iframe src="http://example.com"></iframe>
      </footer>
    </body>
  </html>
zer00ne
  • 41,936
  • 6
  • 41
  • 68
0

You shouldn't use html for this as html is static, if you want a dynamic webpage try to something like PHP.

Have a look at this : https://css-tricks.com/forums/topic/how-to-include-php-headers-and-footers-on-html-site/

Hope it helps.

Ken Ye
  • 77
  • 4