2013-06-24 111 views
1

我剛開始學習SPA應用程序,我遇到了在IE8上運行它的問題。我正在使用mvc4和EF。該應用程序是使用杜蘭達製作的。微風和Internet Explorer 8問題

我使用jQuery 1.10因爲jQuery 2不能在IE 8

工作基本誤差即時得到是

'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。

+1

您是否嘗試過使用最新的微風。 v 1.3.6? –

+0

是的,我做過了。我正在破解的腳本是breeze.debug.js。方法是 function exec(self) - 該行是return contexts.some(function(context){return context.fn(context,self.v);}); – CodeNoob

+0

@JayTraband - 是的。我正在破解的腳本是breeze.debug.js。方法是function exec(self) - 行是return contexts.some(function(context){return context.fn(context,self.v);}); – CodeNoob

回答

5

確保您在'breeze.js'之前包含了es5-shim.js and es5-sham.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> 

它在prerequisites部分記載,但沒有樣品的使用它。如果更新的樣本包括這些,那將會很好。我知道我努力尋找解決這個問題的辦法。

0

舊版瀏覽錯過一些的陣列功能,所以加一些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; 
     }; 
    }