html-include

import header

<head>
    <link rel="import" href="header.html">
  </head>

 

With jQuery:

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


b.html:

<p> This is my include file </p>

 

 

注: 以上两种方法不能用于IE和safari,只能用于chrome。

 

ref: https://www.quora.com/Is-it-any-way-to-include-HTML-page-in-HTML-page

posted @ 2017-02-09 15:39  圆旭  阅读(278)  评论(0编辑  收藏  举报