js json ie不支持json

JSON是包含在JScript 5.8中,而为了向下兼容ie8只有在文档模式是”Internet Explorer 8 Standards”的时候才使用JScripte 5.8,其他时候使用JScripte 5.7特性。因此如果文档模式没有声明为”Internet Explorer 8 Standards”,ie8是找不到JSON对象的。因为没有兼容到ie6/7,所以必然在ie6/7中,JSON会出现未定义的问题。我项目中采用的是方法1,完美解决。

解决方法:

    • 引入定义json的文件json2.js, 
      下载地址:https://github.com/douglascrockford/JSON-js

    • 引入包含json的jQuery文件。

    • 如果不用兼容到ie6/7,只需要声明”Internet Explorer 8 Standards”模式,方法如下: 
      - 在文档头中添加<meta http-equiv="X-UA-Compatible" content="IE=8" > 
      - 使用<!DOCTYPE>来声明文档
原文地址:https://www.cnblogs.com/yelongsan/p/6509893.html