IE 8是否支持JSON.stringify()? [英] Is JSON.stringify() supported by IE 8?

查看:368
本文介绍了IE 8是否支持JSON.stringify()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用:

JSON.stringify()

应该受Chrome,Safari和Firefox的支持。我认为IE8也支持JSON对象。我认为IE7和6没有,所以我这样做:

which should be supported by Chrome, Safari, and Firefox. I think IE8 also has support for the JSON object. I think IE7 and 6 do not, so I'm doing this:

<!--[if lt IE 8]>
    <script src="http://www.json.org/json2.js"></script>
<![endif]-->

所以,我认为这只会在IE6& 7.我查看了托管脚本的URL,仅当IE版本小于9时才包括:

so, I think this will import the external JavaScript only if IE6 & 7. I looked at the URL where the script is hosted, they are including only if the IE version is less than 9:

http://code.google.com/p/html5shiv/
<!--[if lt IE 9]>
    <script src="http://www.json.org/json2.js"></script>
<![endif]-->

所以我也应该将此包含在IE 8中吗?

so should I be including this for IE 8 too?

推荐答案

要直接回答标题中的问题,是IE8原生支持 JSON.stringify()

To answer the question in the title directly, yes IE8 supports JSON.stringify() natively.

IE8是第一个获得此支持的IE版本,开发团队在此详细解释了该功能:
http://blogs.msdn.com/b/ie/archive/2008/09/10 /native-json-in-ie8.aspx

IE8 is the first version of IE to get this support, and the functionality is explained in detail by the dev team here: http://blogs.msdn.com/b/ie/archive/2008/09/10/native-json-in-ie8.aspx

答案问题的第二部分,是的,你需要包含IE6 / IE7的备用功能。像Modernizr这样的东西可以很容易地检查这个。

The answer the second part of the question, yes you would need to include alternate functionality for IE6/IE7. Something like Modernizr can make it easy to check this.

另请注意,如果用户在IE8的兼容性视图中,则JSON对象将不可用。

Also note if the user is in Compatibility View in IE8, the JSON object will not be available.

这篇关于IE 8是否支持JSON.stringify()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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