我们如何在html中包含文件,就像我们通常在Php中包含文件一样。
<?php include "nav.php";?>
答案 0 :(得分:3)
你可以使用jQuery:
<强> HTML 强>
<div id="container"></div>
<强>的jQuery 强>
$("#container").load('somepage.html');
详细了解load
功能以及您可以在documentation中使用它做些什么。
答案 1 :(得分:2)
您可以使用Ajax,请参阅JQuery load function,例如:
<div id="moreData"></div>
$( "#moreData" ).load( "otherPage.html" );
答案 2 :(得分:2)
我的建议是使用jQuery。
<html>
<head>
<script src="jquery.js"></script>
<script>
$(function(){
$("#includeCont").load("file.html");
});
</script>
</head>
<body>
<div id="includeCont"></div>
</body>
</html>
答案 3 :(得分:1)
使用iframe
<!DOCTYPE html>
<html>
<body>
<iframe src="http://www.w3schools.com">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
或使用Frameset
<!DOCTYPE html>
<html>
<frameset cols="25%,*,25%">
<frame src="http://www.w3schools.com/frame_a.php">
<frame src="http://www.w3schools.com/frame_b.php">
<frame src="http://www.w3schools.com/frame_c.php">
</frameset>
</html>
答案 4 :(得分:0)
使用http://httpd.apache.org/docs/current/howto/ssi.html
的方法有一轮服务器端包含
E.g <!--#include virtual="/footer.html" -->
答案 5 :(得分:0)
使用 webpack 和 html-webpack-plugin 是可能的。 这是 index.html。您可以创建多个文件。
像这样。
alb.ingress.kubernetes.io/healthcheck-port: 'PORT'
alb.ingress.kubernetes.io/healthcheck-path: /healthz/ready
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP```
where PORT equals to the istio status-port NodePort value
This way, you update ALB default configuration for the healthcheck to check Istio healthcheck
还有更多。
<%= require('html-loader!./views/partial/nav.html') %>