IE 10, HTML5 and jQuery 2.x - JavaScript runtime error: 'JSON' is undefined

The original article link: http://blogs.msdn.com/b/manish_ahuja/archive/2013/05/16/ie-10-html5-and-jquery-javascript-runtime-error-json-is-undefined.aspx

 

While debugging HTML5 web pages with jQuery based scripts in Visual Studio 2012 using IE 10, if you see an error similar to following:

Error
Unhandled exception at line XXX, column 1 in
http://localhost:8135/Scripts/jquery-X.y.z.js

0x800a1391 - JavaScript runtime error: 'JSON' is undefined

 

Associated Visual Studio 2012 Exception

And  if you are able to debug the same page in Visual Studio 2012 using the latest versions of any of the following browsers without any issues:

  • Opera,
  • Chrome,
  • Firefox and
  • Safari etc.

Then make sure that Compatibility View settings in IE 10 are turned “Off” for the domain (or host name) of the IIS site where your page is hosted. In my case I found that “localhost” was added to Compatibility View, so just removing it from there solved the problem.

IE 10 Compatibility View Settings Dialog

For more details on why this is an issue, will recommend reading following MSDN article:

Defining Document Compatibility

 Update 18-Aug-2013: Changed the blog title to reflect that this applies only to JQuery 2.x. ['JSON' is undefined] is not an issue with JQuery 1.x. 

Following tables further detail out IE 10 behaviour across compatibility modes, settings and jQuery versions:

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值