首页 > 技术文章 > html-include

pinganzi 2017-02-09 15:39 原文

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

推荐阅读