Asp.net mvc 4 Breeze和Internet explorer 8问题

Asp.net mvc 4 Breeze和Internet explorer 8问题,asp.net-mvc-4,breeze,single-page-application,Asp.net Mvc 4,Breeze,Single Page Application,我刚刚开始学习SPA应用程序,在IE8上运行时遇到问题。我正在使用mvc4和EF。该应用程序是使用durandal构建的 我使用jQuery1.10是因为jQuery2不适用于IE8 基本上我得到的错误是 'Unhandled exception at line 786, column 9 in http://localserver/scripts/breeze.debug.js 0x800a01b6 - Microsoft JScript runtime error: Object does

我刚刚开始学习SPA应用程序,在IE8上运行时遇到问题。我正在使用mvc4和EF。该应用程序是使用durandal构建的

我使用jQuery1.10是因为jQuery2不适用于IE8

基本上我得到的错误是

'Unhandled exception at line 786, column 9 in http://localserver/scripts/breeze.debug.js

0x800a01b6 - Microsoft JScript runtime error: Object doesn't support this property or method'.

该应用程序在firefox和chrome上运行良好。

请确保您在“breeze.js”之前包含了该应用程序

例如:

<!--[if lt IE 9]>
      <script src="Scripts/es5-shim.js"></script>
      <script src="Scripts/es5-sham.js"></script>
<![endif]-->
<script src="Scripts/jquery-1.9.1.js"></script>
<script src="Scripts/knockout-2.2.1.js"></script>
<script src="/Scripts/q.min.js"></script>
<script src="/Scripts/breeze.debug.js"></script>

本节对其进行了记录,但没有一个样本使用它。如果更新的样本中包含这些,那就太好了。我知道我很难找到这个问题的解决方案。

请确保在“breeze.js”之前已经包含了

例如:

<!--[if lt IE 9]>
      <script src="Scripts/es5-shim.js"></script>
      <script src="Scripts/es5-sham.js"></script>
<![endif]-->
<script src="Scripts/jquery-1.9.1.js"></script>
<script src="Scripts/knockout-2.2.1.js"></script>
<script src="/Scripts/q.min.js"></script>
<script src="/Scripts/breeze.debug.js"></script>

本节对其进行了记录,但没有一个样本使用它。如果更新的样本中包含这些,那就太好了。我知道我很难找到这个问题的解决方案。

较旧的浏览器缺少一些数组函数,所以添加一些javascript:

    if (!('bind' in Function.prototype)) {
        Function.prototype.bind= function(owner) {
            var that= this;
            if (arguments.length<=1) {
                return function() {
                    return that.apply(owner, arguments);
                };
            } else {
                var args= Array.prototype.slice.call(arguments, 1);
                return function() {
                    return that.apply(owner, arguments.length===0? args : args.concat(Array.prototype.slice.call(arguments)));
                };
            }
        };
    }

    if (!('trim' in String.prototype)) {
        String.prototype.trim= function() {
            return this.replace(/^\s+/, '').replace(/\s+$/, '');
        };
    }

    if (!('indexOf' in Array.prototype)) {
        Array.prototype.indexOf= function(find, i /*opt*/) {
            if (i===undefined) i= 0;
            if (i<0) i+= this.length;
            if (i<0) i= 0;
            for (var n= this.length; i<n; i++)
                if (i in this && this[i]===find)
                    return i;
            return -1;
        };
    }
    if (!('lastIndexOf' in Array.prototype)) {
        Array.prototype.lastIndexOf= function(find, i /*opt*/) {
            if (i===undefined) i= this.length-1;
            if (i<0) i+= this.length;
            if (i>this.length-1) i= this.length-1;
            for (i++; i-->0;) /* i++ because from-argument is sadly inclusive */
                if (i in this && this[i]===find)
                    return i;
            return -1;
        };
    }
    if (!('forEach' in Array.prototype)) {
        Array.prototype.forEach= function(action, that /*opt*/) {
            for (var i= 0, n= this.length; i<n; i++)
                if (i in this)
                    action.call(that, this[i], i, this);
        };
    }
    if (!('map' in Array.prototype)) {
        Array.prototype.map= function(mapper, that /*opt*/) {
            var other= new Array(this.length);
            for (var i= 0, n= this.length; i<n; i++)
                if (i in this)
                    other[i]= mapper.call(that, this[i], i, this);
            return other;
        };
    }
    if (!('filter' in Array.prototype)) {
        Array.prototype.filter= function(filter, that /*opt*/) {
            var other= [], v;
            for (var i=0, n= this.length; i<n; i++)
                if (i in this && filter.call(that, v= this[i], i, this))
                    other.push(v);
            return other;
        };
    }
    if (!('every' in Array.prototype)) {
        Array.prototype.every= function(tester, that /*opt*/) {
            for (var i= 0, n= this.length; i<n; i++)
                if (i in this && !tester.call(that, this[i], i, this))
                    return false;
            return true;
        };
    }
    if (!('some' in Array.prototype)) {
        Array.prototype.some= function(tester, that /*opt*/) {
            for (var i= 0, n= this.length; i<n; i++)
                if (i in this && tester.call(that, this[i], i, this))
                    return true;
            return false;
        };
    }

较旧的浏览器缺少一些数组函数,因此添加一些javascript:

    if (!('bind' in Function.prototype)) {
        Function.prototype.bind= function(owner) {
            var that= this;
            if (arguments.length<=1) {
                return function() {
                    return that.apply(owner, arguments);
                };
            } else {
                var args= Array.prototype.slice.call(arguments, 1);
                return function() {
                    return that.apply(owner, arguments.length===0? args : args.concat(Array.prototype.slice.call(arguments)));
                };
            }
        };
    }

    if (!('trim' in String.prototype)) {
        String.prototype.trim= function() {
            return this.replace(/^\s+/, '').replace(/\s+$/, '');
        };
    }

    if (!('indexOf' in Array.prototype)) {
        Array.prototype.indexOf= function(find, i /*opt*/) {
            if (i===undefined) i= 0;
            if (i<0) i+= this.length;
            if (i<0) i= 0;
            for (var n= this.length; i<n; i++)
                if (i in this && this[i]===find)
                    return i;
            return -1;
        };
    }
    if (!('lastIndexOf' in Array.prototype)) {
        Array.prototype.lastIndexOf= function(find, i /*opt*/) {
            if (i===undefined) i= this.length-1;
            if (i<0) i+= this.length;
            if (i>this.length-1) i= this.length-1;
            for (i++; i-->0;) /* i++ because from-argument is sadly inclusive */
                if (i in this && this[i]===find)
                    return i;
            return -1;
        };
    }
    if (!('forEach' in Array.prototype)) {
        Array.prototype.forEach= function(action, that /*opt*/) {
            for (var i= 0, n= this.length; i<n; i++)
                if (i in this)
                    action.call(that, this[i], i, this);
        };
    }
    if (!('map' in Array.prototype)) {
        Array.prototype.map= function(mapper, that /*opt*/) {
            var other= new Array(this.length);
            for (var i= 0, n= this.length; i<n; i++)
                if (i in this)
                    other[i]= mapper.call(that, this[i], i, this);
            return other;
        };
    }
    if (!('filter' in Array.prototype)) {
        Array.prototype.filter= function(filter, that /*opt*/) {
            var other= [], v;
            for (var i=0, n= this.length; i<n; i++)
                if (i in this && filter.call(that, v= this[i], i, this))
                    other.push(v);
            return other;
        };
    }
    if (!('every' in Array.prototype)) {
        Array.prototype.every= function(tester, that /*opt*/) {
            for (var i= 0, n= this.length; i<n; i++)
                if (i in this && !tester.call(that, this[i], i, this))
                    return false;
            return true;
        };
    }
    if (!('some' in Array.prototype)) {
        Array.prototype.some= function(tester, that /*opt*/) {
            for (var i= 0, n= this.length; i<n; i++)
                if (i in this && tester.call(that, this[i], i, this))
                    return true;
            return false;
        };
    }

你试过使用最新的微风吗。v1.3.6?是的,我有。我发现正在中断的脚本是breeze.debug.js。方法是function execself-行是return contexts.somefunctioncontext{return context.fncontext,self.v;}@杰特拉邦-是的,我做了。我发现正在中断的脚本是breeze.debug.js。方法是function execself-行是return contexts.somefunctioncontext{return context.fncontext,self.v;}@CodeNoob,你能把你的测试解决方案发送到breeze@ideablade.com. 这样我们可以进一步调查。你试过使用最新的Breeze吗。v1.3.6?是的,我有。我发现正在中断的脚本是breeze.debug.js。方法是function execself-行是return contexts.somefunctioncontext{return context.fncontext,self.v;}@杰特拉邦-是的,我做了。我发现正在中断的脚本是breeze.debug.js。方法是function execself-行是return contexts.somefunctioncontext{return context.fncontext,self.v;}@CodeNoob,你能把你的测试解决方案发送到breeze@ideablade.com. 这样我们可以进一步调查。