IE 11 Downloads Page instead of opening it, works

2019-09-18 20:38发布

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

Do you want to open or save XXXXXX from XXXXXX message.

Tried debugging the site in IE, and the console shows a warming:

HTML1527: DOCTYPE expected. Consider adding a valid HTML5 doctype: ""

however this is the first line of the HTML.

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).

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.

Here is the code:

<!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>&copy;  - 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>

2条回答
老娘就宠你
2楼-- · 2019-09-18 20:57

Found the problem.

In my initial 'home' view, I redirected the user to the login page incorrectly.

Originally, I had:

return render(request, "registration/login.html", {}, RequestContext(request))

Which was incorrect, and should have been:

return render(request, "registration/login.html")

This was creating an issue with the HTTP Headers, and confusing IE 11.

查看更多
欢心
3楼-- · 2019-09-18 21:23
  1. Click on Tools > Internet Options or Internet Options in the gear menu.
  2. Click the "Advanced" tab Click "Restore Advanced Settings".
  3. Close Internet Explorer and re-open it.
查看更多
登录 后发表回答