我在使用PHP开发的lighttpd服务器上运行了一个Web应用程序calle myapp
。
Chrome和Firefox都能正确显示我的页面以及Edge。但是,当我使用IE11时,它根本不呈现页面样式表(css)。查看调试窗口(F12),它会加载text/html
类型而不是type/css
的CSS文件,这会导致IE11抱怨。
IE11抱怨使用 SEC7113 错误:“由于mime类型不匹配而忽略了CSS”
使用Internet Explorer在SO上有几个与SEC7113错误相关的帖子,但没有一个能够解决我的问题。
我的环境数据:
我已将lighttpd
安装为网络服务器。我的lighttpd.conf
配置文件:
server.modules += (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",
"mod_setenv",
"mod_fastcgi"
)
server.document-root = "/usr/local/sbin/www"
server.upload-dirs = ( "/usr/local/sbin/www/uploads" )
server.errorlog = "/var/log/lighttpd_error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.max-request-size = 2097152
server.network-backend = "writev"
#
# Redirect to public folder
#
url.redirect = ("^/$" => "/myapp/public" )
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# default listening port for IPv6 falls back to the IPv4 port
## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
#
# PHP CGI Configuration
#
fastcgi.server = (".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket",
"bin-environment" => (
"PATH" => env.PATH,
"MYAPP_HOME" => env.MYAPP_HOME,
"LD_LIBRARY_PATH" => env.LD_LIBRARY_PATH
)
))
)
#
# Set environment variables
#
setenv.add-environment = ("PATH" => env.PATH,
"MYAPP_HOME" => env.MYAPP_HOME,
"LD_LIBRARY_PATH" => env.LD_LIBRARY_PATH
)
#
# Rewrite rules
#
url.rewrite-if-not-file = (
"^([a-zA-Z0-9\/\-_]+)\.?([a-zA-Z]+)?$" => "/myapp/public/index.php?url=$1&extension=$2",
"^([a-zA-Z0-9\/\-_]+)\??(.+)?$" => "/myapp/public/index.php?url=$1&$2")
#
# Mimetype assign
#
mimetype.assign += ( ".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png",
".css" => "text/css",
".js" => "text/javascript"
)
我加载的HTML页面(使用PHP动态构建):
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Traansit AEI RTU</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<span><base href="/myapp/public/"><!-- [if lte IE 6]></base><![endif]-->
<link rel="stylesheet" type="text/css" media="all" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="all" href="css/traansit.bootstrap-datetimepicker.css">
<link rel="stylesheet" type="text/css" media="all" href="DataTables/datatables.min.css">
<script type="text/javascript" charset="UTF-8" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="js/bootstrap.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="js/moment-with-locales.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="DataTables/datatables.min.js"></script>
</span>
<body>
<base href=/myapp/public/>
<div class="row">
<div class="col-md-12">
<br />
<div class="col-md-5 col-md-offset-1">
<img src="img/my_logo_sm.jpg" />
</div>
<div class="col-md-5 text-right">
<h3>MYAPP</h3>
</div>
</div>
</div>
<div class="container-fluid">
<div id="dialogDiv"></div>
<div class="row">
<div class="col-md-6 col-md-offset-1">
<div class="jumbotron" style="height: 470px">
<h4>MY APPLICATION</h4>
</div>
</div>
<div class="col-md-4">
<div class="jumbotron" style="height: 470px">
<h4>Logon:</h4>
<br />
<form method="post">
<div class="form-group">
<label>Username:</label>
<input class="form-control" placeholder="Username" type="text" name="username">
</div>
<div class="form-group">
<label>Password:</label>
<input class="form-control" placeholder="Password" type="password" name="password">
</div>
<div class="form-group">
<button class="btn btn-primary" type="submit" name="action" value="login">Submit</button>
</div>
</form>
</div>
</div>
</div>
<footer></footer>
</body>
</html>
最后我检查了我的注册数据库,发现我的HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.css ContentType ="text/css"
我不知道问题出在lighttpd服务器上是否在HTML页面中没有正确设置正确类型的页面类型。
帮助表示赞赏。
OBS:
正如格雷厄姆所指出的,这是IE1的一个已知问题
1(见this link)。我的问题是如何解决它没有 建议的解决方案正在发挥作用。
我在笔记本电脑上使用IE连接到Linux上的lighttpd服务器 机器在我的本地网络上。所以,我正在远程访问该页面。