JSON对象在Internet Explorer 8中未定义 [英] JSON object undefined in Internet Explorer 8

查看:95
本文介绍了JSON对象在Internet Explorer 8中未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  var res =JSON =+ JSON 

目前我正在编写一个JavaScript文件并具有以下行: .stringify(结果);

结果正设置在这条线的上方。我遇到的问题是,只有IE8(即IE8)正在向我报告JSON以某种方式未定义。我不知道该怎么做,因为据我了解,IE8是一个实现了JSON支持的浏览器。有没有人有任何想法可能会发生什么?

解决方案

通过使用首选项确保您实际处于IE 8模式方法,一个标准的doctype ...

 <!DOCTYPE html> 

...或不需要的方法, X-UA兼容元标记/标题...

 < meta http-equiv =X-UA兼容content =IE = EDGE/> 

请参阅定义文档兼容性以获取更多信息。


Currently I'm writing a JavaScript file and have the following line:

var res = "JSON=" + JSON.stringify(result);

result is being set just above this line. The issue I'm having is that IE8 (IE8 only, that is) is reporting to me that JSON is undefined somehow. I'm not sure what to make of this since, as I understood it, IE8 is a browser that implemented JSON support. Does anyone have any idea what might be going on?

解决方案

Make sure you're actually in IE 8 mode by using the preferred method, a standards doctype...

<!DOCTYPE html>

...or the undesired method, the X-UA-Compatible meta tag/header...

<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />

See Defining Document Compatibility for more information.

这篇关于JSON对象在Internet Explorer 8中未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆