簡體   English   中英

為什么IE11上有奇怪的行為?

[英]Why is there strange behaviour on IE11?

我的jQuery Mobile網站的部署版本似乎存在問題。 在本地計算機上運行,​​看起來還可以。

但是,當部署到測試服務器時,jQuery Mobile的用戶界面遇到了問題(如下圖所示)。 我已經在IE11和Chrome上測試了已部署的網頁。 在Chrome上,它看起來完全像本地托管版本,因此在IE11上只是“奇怪”的iu。

在此處輸入圖片說明

除了文件的路徑(css / js)外,兩個版本的HTML源當然是相同的,但是在Chrome上,它在兩個“版本”上均有效。

<!DOCTYPE html>
<html>
<head>
  <title></title>
  <meta name="viewport" content="width=device-width" initial-scale="1" />
  <!-- Styles -->
  <link href="/Content/Site.css" rel="stylesheet" type="text/css"/>
  <link href="/Content/jquery.mobile-1.4.2.css" rel="stylesheet" type="text/css"/>
  <link href="/Content/jquery.mobile.datepicker.css" rel="stylesheet" type="text/css"/>
  <!-- Scripts -->
  <script src="/Scripts/Bundles/jquery?v=_evuqQpQzfiv74i_e2xne0q8qDFolKEd-XnaMgC-rWw1"></script>

  <script src="/Scripts/jquery.ui.datepicker-nb-NO.js"></script>
  <script src="/Scripts/Bundles/jqueryMobile?v=sCRDQK2ukYmfF8e6gB7crpqBhGj3REAZ0OWnxCy4ozU1"></script>

</head>
<body>
  <div data-role="page" data-theme="a">
    <div data-role="header" data-theme="a">
      <a href="/" data-icon="home" data-iconpos="notext">Home</a>

      <h1></h1>
    </div>
    <div data-role="content">

<a href='#' data-role="button"><div><div class="btn-icon-text">Button 1</div></div></a>
<a href='#' data-role="button"><div><div class="btn-icon-text">Button 2</div></div></a>

    </div>
    <div data-role="footer" data-position="fixed" data-theme="a">
      <div id="leftBottomContent" style="float: left"><a href="#" data-rel="back" class="ui-btn">back</a></div>
      <div id="rightBottomContent" style="float: right"></div>
      <div id="centerBottomContent" style="margin-left: auto; margin-right: auto; text-align: center; margin-top: 15px;"></div>
    </div>
  </div>
</body>
</html>

我已經使用Fiddler檢查了服務器的請求是否正常。 誰能指出我的想法來解決這個問題?

因此,在您自己的PC上設置兼容模式可以為您解決問題,但是其他嘗試使用您的應用程序的人呢?

您可以在布局中添加一個meta標頭,以強制使用兼容模式,從而使其兼容,從而使其他人不會遇到與您看到的相同的問題

<meta http-equiv="X-UA-Compatible" content="IE=9">

確保在HTML中<head>標記后立即添加此標記

在Intranet網站上關閉兼容模式解決了我的問題

在您的標題頁中添加以下代碼,這使用戶在使用應用程序時默認使用兼容模式:

    <%
    response.addHeader("X-UA-Compatible", "IE=edge");
    %>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM