IE 11下载页面而不是打开它,可在Chrome和Firefox中使用
我有一个在Ubuntu
,Apache server
上运行的Django application
,在Chrome
和Firefox
下都可以正常运行,但是当我通过Internet Explorer 11
访问它时,它将不会加载.我没有在浏览器窗口中呈现HTML,而是收到
I have a Django application
running on a Ubuntu
, Apache server
that works perfectly under Chrome
and Firefox
, however when I access it via Internet Explorer 11
, it will not load. Instead of rendering the HTML in the browser window, I receive the
您要从XXXXXX消息中打开或保存XXXXXX.
Do you want to open or save XXXXXX from XXXXXX message.
尝试在IE中调试站点,控制台显示变暖:
Tried debugging the site in IE, and the console shows a warming:
HTML1527:预期为DOCTYPE.考虑添加有效的HTML5文档类型: "
HTML1527: DOCTYPE expected. Consider adding a valid HTML5 doctype: ""
但这是HTML的第一行.
however this is the first line of the HTML.
在Chrome中,不会出现此错误,但我收到有关包含密码字段的页面的警告(由于我仍在开发中,因此尚未翻转到https).
In Chrome, this error does not appear but I get a warning about the page including a password field (have not flipped to https yet as I am still in development).
我唯一能找到的(调试中)是内容类型"显示为空白,但是我查看的其他站点都有条目(文本/html等),但是我看不到如何填充它信息.
The only other thing I can find (in debug) is that the "Content Type" shows up blank, but other sites I review have entries (text/html, etc.) but I don't see how to populate this information.
请告知我该如何进一步解决此问题,以查找导致页面无法加载的原因.
Please advise how I can troubleshoot this further to find the cause of the page not loading.
这是代码:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ops</title>
<link rel="stylesheet" type="text/css" href="/static/content/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/static/content/site.css" />
<script src="/static/scripts/modernizr-2.6.2.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top opsBlack">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img src="/static/images/test-N.png" width ="40" align="left"/>
<a href="/" class="navbar-brand">ops</a>
</div>
<div class="navbar-collapse collapse opsBlack">
<ul class="nav navbar-nav">
<li><a href=#>Test</a></li>
<li><a href=#>Test</a></li>
<li><a href=#>Test</a></li>
<li><a href="#" class="bluetext">Mar 28, 2017</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="../registration/login.html">Log in</a></li>
</ul>
</div>
</div>
</div>
<h2></h2>
<div class="row">
<div class="col-md-8">
<section id="loginForm">
<form action="/accounts/login/" method="post" class="form-horizontal">
<input type='hidden' name='csrfmiddlewaretoken' value='deleted' />
<h4>Use your Account to log in.</h4>
<hr />
<div class="form-group">
<label for="id_username" class="col-md-2 control-label">User name</label>
<div class="col-md-10">
<input type="text" class="form-control" placeholder="Username" required=Yes name="username" />
</div>
</div>
<div class="form-group">
<label for="id_password" class="col-md-2 control-label">Password</label>
<div class="col-md-10">
<input type="password" class="form-control" placeholder="Password" required=Yes name="password"/>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="hidden" name="next" value="/" />
<input type="submit" value="Log in" class="btn btn-default" />
</div>
</div>
</form>
</section>
</div>
</div>
<hr/>
<footer>
<p>© - ops</p>
</footer>
<script src="/static/scripts/jquery-1.10.2.js"></script>
<script src="/static/scripts/bootstrap.js"></script>
<script src="/static/scripts/respond.js"></script>
</body>
</html>
发现了问题.
在我的初始主页"视图中,我错误地将用户重定向到登录页面.
In my initial 'home' view, I redirected the user to the login page incorrectly.
最初,我有:
return render(request, "registration/login.html", {}, RequestContext(request))
哪个不正确,应该是:
return render(request, "registration/login.html")
这在HTTP标头中造成了一个问题,并使IE 11感到困惑.
This was creating an issue with the HTTP Headers, and confusing IE 11.