javascript - Include html in another html file -


i have html "head" template , navigation template want include in other html files site. found post:

include html file in html file

and question is... if it's header want include?

so example, have following file structure:

 /var/www/includes/templates/header.html                              navigation.html 

header.html might this:

<!doctype html> <html lang="en"> <head>      <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">     <meta name="description" content="">     <meta name="author" content="">      <title>test portal</title>   </head> 

in case this, can still follow example in other post create div , populate div via jquery?

in opinion best solution

<html>    <head>      <script src="jquery.js"></script>      <script>      $(function(){       $("#includedcontent").load("b.html");      });     </script>    </head>     <body>       <div id="includedcontent"></div>   </body>  </html> 

there no such tags available include file there third party methods available .

<!doctype html> <html> <script src="http://www.w3schools.com/lib/w3data.js"></script>  <body>  <div w3-include-html="content.html"></div>   <script> w3includehtml(); </script>  </body> </html> 

some people used

<!--#include virtual="a.html" -->  

Comments