最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Maximum call stack size exceeded during JSON.stringify(navigator) - Stack Overflow

programmeradmin3浏览0评论

I am getting RangeError during serialization of Navigator object.

What could be the reason?

JSON.stringify(navigator);
RangeError: Maximum call stack size exceeded

Browser: Chrome

I am getting RangeError during serialization of Navigator object.

What could be the reason?

JSON.stringify(navigator);
RangeError: Maximum call stack size exceeded

Browser: Chrome

Share Improve this question edited Jan 12, 2013 at 5:45 P K asked Jan 12, 2013 at 5:38 P KP K 10.2k13 gold badges56 silver badges99 bronze badges 2
  • You need to show what is inside the navigator object. – StilesCrisis Commented Jan 12, 2013 at 5:42
  • 1 Basically, your navigator object is too big. – Alex W Commented Jan 12, 2013 at 5:44
Add a ment  | 

3 Answers 3

Reset to default 4

That's because, as the error message says, the navigator object is too big.

You can use dystroy's modified JSON function like this:

var navJSON = JSON.pruned(navigator);

The object returned is pretty huge, but it's almost certain that it isn't pletely correct. If you want to transfer data about the navigator object using JSON, you should send those properties only, not the entire object.

Why dont you copy the specific values you are interested over to a new object and then serialize that instead?

Maybe its finding a property that results in an endless loop.

Maybe navigator object contain the self-link. You should copy navigator in other object and delete big links on them.

发布评论

评论列表(0)

  1. 暂无评论