JSON.stringify在IE中不起作用 [英] JSON.stringify does not work in IE

查看:357
本文介绍了JSON.stringify在IE中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了以下方法:

JSON.stringify(json,null,2);

这会在IE以外的所有浏览器中生成选项卡式输出:在IE中,它会显示一行。是 null 问题,如果有的话有什么选择?

This produces tabbed output in all browsers except IE: in IE, it displays a single line. Is null the problem and if so what are the alternatives?

推荐答案

您可以使用jquery.min.js或最新版本或1.8.2版本并将其放在< head> 元素中:

You Can use jquery.min.js or latest or 1.8.2 version and put this in the <head> element:

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

适用于IE8及以上版本。

It works in IE8 and above.

这篇关于JSON.stringify在IE中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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