javascript - How to include one html file in another ? What is the best and efficient way? -


this question has answer here:

i looking best approach include 1 html file in another. need create 1 header , footer file included in multiple pages across app. header/footer file may contain required css , js. , may want include other templates can use popup etc. know can by

  • ajax
  • html5 import(not supported in of browser. not useful)

any other way? or best way take care of performance.

thanks in advance...

solution: wanted update here approach took problem. using grunt. use include plugin available in run during creating build include different html files together. anyway time...

<html> <head> <title></title> <script src="//code.jquery.com/jquery-1.10.2.js"></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> 

include header.html , footer.html @ same location index.html


Comments