我有一个通过 IIS 7.5 运行的站点,其页面以 UTF-8 编码(请注意,如果我恢复为 ASCII,则不会出现以下问题)。我有一个包含页眉和页脚内容的 Main.html 页面。当通过 SSI 包含这些文件时,空白被注入正文并强制我的页面内容向下。如果我将文件组合在一起,这个问题就会消失。这个问题和我的一样,但答案对我不起作用。
考虑以下 4 页:
SSI.html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Humble Site</title>
<!--#include file="SSIIncludes.html" -->
</head>
<body>
<form id="Form1" runat="server" onsubmit="return false;">
<!--#include file="SSIHeader.html" -->
<div>Here's my content</div>
<script type="text/javascript">
//do some work
</script>
<!--#include file="SSIFooter.html" -->
</form>
</body>
</html>
SSIIncludes.html:
<link rel="stylesheet" type="text/css" href="js/jquery.ui.all.css" />
<script type="text/javascript">
var debug = false;
if (debug) {
document.write('<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-1.6.1.js"><\/script>');
document.write('<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-ui-1.8.12/ui/jquery-ui.js"><\/script>');
} else {
document.write('<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-1.6.1.min.js"><\/script>');
document.write('<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-ui-1.8.12/ui/minified/jquery-ui.min.js"><\/script>');
}
</script>
SSIHeader.html:
<div>
<div>
<div>
Something's in a Header!
</div>
SSIFooter.html:
<div>
Have a Footer!
</div>
</div>
</div>
<br />
<br />
<br />
当我查看页面时,我在第一个 div 文本之前看到一大块空白(在浏览器中呈现)。探索浏览器中的源代码显示:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Humble Site</title>
</head>
<body>
""
<link rel="stylesheet" type="text/css" href="js/jquery.ui.all.css">
<script type="text/javascript">
var debug = false;
if (debug) {
document.write('<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-1.6.1.js"><\/script>');
document.write('<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-ui-1.8.12/ui/jquery-ui.js"><\/script>');
} else {
document.write('<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-1.6.1.min.js"><\/script>');
document.write('<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-ui-1.8.12/ui/minified/jquery-ui.min.js"><\/script>');
}
</script>
<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="js/thirdparty/jquery/core/jquery-ui-1.8.12/ui/minified/jquery-ui.min.js"></script>
<form id="Form1" runat="server" onsubmit="return false;">
"
"
<div class="OwnerOfAllPlaces">
<div id="OuterPlace" class="OuterPlace">
<div>
Something's in a Header!
</div>
<div>Here's my content</div>
<script type="text/javascript">
//do some work
</script>
"
"
<div>
Have a Footer!
</div>
</div>
</div>
<br>
<br>
<br>
</form>
</body></html>
我怎样才能在我的包含点摆脱这些“”“”块?