• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 139
  • Last Modified:

Linking to html source docs

I have a header with a logo and an options bar which I include in every html document.  Instead of copying and pasting it into every doc, is there a way I can include it or reference it somehow, similar to how multiple source code documents can be referenced in C using the #include command?  
  • 2
2 Solutions
If your server support serverside includes you could try:

     <!--#include virtual="header.html"-->
     page content
     <!--#include virtual="footer.html"-->

chsalviaAuthor Commented:
So, this can only be done from the server side?

One way that occured to me, which is probably kind of strange, is to write the header in javascript, and then include it using <script src = "">.
That's a good solution as well, although you might run into problem with non-js clients/visitors.

you could do it with a linked script that does a document write, but it wouldn't be visible to folks with scripting disabled in their browser.

you can 'include' files similar to your reference to C using server side scripting too.... this briefly describes the process in php (and asp)...


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now