开发者

knockout loads, but does not work in IE

I'm building a client-side application with jquery and knockoutjs. It works great in FF and Chrome, but crashes in a really puzzling way in IE v8.

For debugging, I'm running this code:

$(document).ready(function(){
  //A bunch of code that works fine ...
  //...
  alert( viewModel );
  alert( ko.toJSON );
  alert( ko.toJSON(viewModel) );
  ko.applyBindings(viewModel);
  alert( "Done" );
});

IE gives me two alert boxes:

[object Object]

and

开发者_JS百科
function(a){a=p.oa(a);return p.a.Y(a)}

The first one is my viewModel. I believe the second is the minimized ko.toJSON command. Why can't it run the third alert? This happens even if I set viewModel to something simple, like {};

(BTW, the ko.applybindings line doesn't work either. That's why I was debugging in the first place.)


It looks like you are running in IE 8 Compatibility Mode or in IE 7 Mode. Hit F12 and check your browser mode.


I know some versions of IE don't support JSON natively and so it has to be included as a JavaScript include. Crockford's JSON2 parser: https://github.com/douglascrockford/JSON-js

But the compatibility mode of IE, if set correctly should also resolve this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜