【问题标题】:How do you get the Hot Towel template to work with IE 8?如何让 Hot Towel 模板与 IE 8 一起使用?
【发布时间】:2013-05-22 23:34:36
【问题描述】:

我使用热毛巾模板构建了一个原型,该模板在大多数浏览器中都可以找到,但在 IE8 文档模式下查看时不显示任何内容(使用 IE 9 开发人员工具)。对于 Code camper 示例应用程序也会发生同样的情况。

我的假设是它是一个 HTML 5 问题,所以我尝试了以下方法。

  1. 添加了 html5shiv 和 es5-shim nuget 包。

  2. 为 Bundle config.cs 中的脚本创建一个新的包,即

    new ScriptBundle("~/scripts/compat") .Include("~/scripts/es5-shim.js") .include("~/scripts/html5shiv.js") );

  3. 将新包添加到 index.cshtml 视图中

    @使用 System.Web @使用 System.Web.Optimization 热毛巾SPA

    @Styles.Render("~/Content/css")
    <script type="text/javascript">
        if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
            var msViewportStyle = document.createElement("style");
            var mq = "@@-ms-viewport{width:auto!important}";
            msViewportStyle.appendChild(document.createTextNode(mq));
            document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
        }
    </script>
    @Scripts.Render("~/scripts/compat")
    

但问题仍然存在。有谁知道如何解决这个问题还是我错过了其他东西。

【问题讨论】:

    标签: html internet-explorer backwards-compatibility hottowel


    【解决方案1】:

    只需在 Breeze 进入之前将 es5 Shim 和 Sham 库添加到供应商捆绑包中即可。

    bundles.Add(
              new ScriptBundle("~/scripts/vendor")
                .Include("~/scripts/jquery-{version}.js")
                .Include("~/scripts/knockout-{version}.debug.js")
                .Include("~/scripts/sammy-{version}.js")
                .Include("~/scripts/toastr.js")
                .Include("~/scripts/Q.js")
                .Include("~/scripts/es5-shim.min.js")
                .Include("~/scripts/es5-sham.min.js")
                .Include("~/scripts/breeze.debug.js")
                .Include("~/scripts/bootstrap.js")
                .Include("~/scripts/moment.js")
              );
    

    【讨论】:

      猜你喜欢
      • 2013-02-09
      • 1970-01-01
      • 2013-03-10
      • 1970-01-01
      • 2013-02-12
      • 2014-10-12
      • 2016-02-08
      • 2013-04-05
      • 2017-07-06
      相关资源
      最近更新 更多