如何在IE中禁用兼容性视图?

时间:2013-07-16 07:21:52

标签: html internet-explorer quirks-mode

当我打开我的网站时,它会在兼容性视图中显示。但我不希望我的网站在兼容性视图中打开。我已经检查了一些解决方案,但它们没有工作。有谁知道我哪里出错了?

我的代码是

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Admin Login</title>
    <link rel="Stylesheet" type="text/css" href="<%= Url.MunroContent("~/Content/LoginCSS/style.css")%>" />
    <script src="<%=Url.MunroContent("~/Scripts/jquery-1.7.1.min.js")%>" type="text/javascript"></script>
    <script src="<%=Url.MunroContent("~/Scripts/jquery-ui-latest.js")%>" type="text/javascript"></script>
    <script src="<%=Url.MunroContent("~/Scripts/tabbedpanel.js")%>" type="text/javascript"></script>
    <script src="<%=Url.MunroContent("~/Scripts/jquery.unobtrusive-ajax.min.js")%>" type="text/javascript"></script>
    <script src="<%=Url.MunroContent("~/Scripts/cross_browsers.js")%>" type="text/javascript"></script>
/head>
<body>
    <div id="wrapper">
        <div class="header">
        </div>
        <div class="munrologo">
            <a href="#">
                <img src="<%= Url.Content("../../Content/Images/munro_logo.jpg") %>" alt="logo" /></a></div>
        <div class="loginBox">
            <div class="login">
                <%using (Html.BeginForm("Login", "Login", FormMethod.Post))%>
                <% { %>
                <div class="singleline error-line">
                    <label id="labelMessage" style="color: #FF0000;">
                        <%: TempData["LoginErrorMessage"] %></label>
                </div>
                <div class="singleline">
                    <label>
                        User name:</label>
                    <input type="text" id="username" name="username" maxlength="23" />
                    <span id="UserNameMessgae" style="display: none">
                        <label style="color: #FF0000;">
                            Please enter user name</label></span>
                </div>
                <div class="singleline">
                    <label>
                        Password:</label>
                    <input type="password" id="password" name="password" maxlength="23" />
                    <span id="UserPasswordMessage" style="display: none">
                        <label style="color: #FF0000;">
                            Please enter password</label></span>
                </div>
                <div class="singleline">
                    <br />
                    <button type="button" onclick="ForgotPassword()" class="forgotpassword-btn" value="Login"
                        tabindex="-1">
                        Forgot password?</button>
                    <input name="image" id="btnLogin" type="submit" onclick="return ValidateLogin();"
                        class="btnlogin" value="Login" style="display: none" />
                </div>
                <div class="singleline error-line">
                    <noscript>
                        <div>
                            You must enable java script to continue.
                        </div>
                    </noscript>
                    <% if (Request.Browser.Cookies)
                       {
                           if (Request.IsSupportedBrowser())
                           { %>
                    <script type="text/javascript">
                        $('#btnLogin').show();
                    </script>
                    <% }
                           else
                           {
                    %>
                    Your browser / version is not supported. Supported browsers are IE 8.0 and above,
                    Firefox 15.0 and above, Chrome 20.0 and above, Safari 5.1 and above.
                    <%
                           }
                       }
                       else
                       {%>
                    Please enable cookie to continue with login.
                    <%} %>
                </div>
            </div>
            <% }%>
        </div>
        <div id="clearfooter">
        </div>
        <!-- end #clearfooter -->
    </div>
    <div id="footer">
        ©2011 munro.com
        <!-- #footer sits outside the #wrapper -->
    </div>
    <!-- end #footer -->
</body>
</html>

我正在使用MVC3。

1 个答案:

答案 0 :(得分:-1)

您是否检查过IIS管理器中的HTTP响应标头? 也许IIS服务器正在强制浏览器以兼容模式运行。因为我没有看到你的代码中的元标记有什么问题。 IE = EDGE意味着浏览器将以最高的兼容性运行。

您是否在多台计算机上测试过您的网站?