admin管理员组

文章数量:1335386

I have a page, that works fine in FF and IE. However, chrome throws

jquery.min.js:2    Uncaught RangeError: Maximum call stack size exceeded

It's because of trying to process a lot of data (see Chrome RangeError: Maximum call stack size exceeded when using jQuery $.map).

Is it possible to catch the error, so that the whole page's javascript doesn't hang? Or do I have to reduce the amount of data for chrome.

I have a page, that works fine in FF and IE. However, chrome throws

jquery.min.js:2    Uncaught RangeError: Maximum call stack size exceeded

It's because of trying to process a lot of data (see Chrome RangeError: Maximum call stack size exceeded when using jQuery $.map).

Is it possible to catch the error, so that the whole page's javascript doesn't hang? Or do I have to reduce the amount of data for chrome.

Share Improve this question edited May 23, 2017 at 12:08 CommunityBot 11 silver badge asked Aug 20, 2012 at 15:37 mreqmreq 6,5424 gold badges38 silver badges57 bronze badges 5
  • I doubt it has to do with trying to process a lot of data; that other question has no answers, and I doubt it was the problem there too. You posted no code, so it's impossible to say what's going on. – Pointy Commented Aug 20, 2012 at 15:42
  • There's no recursion in the code. I think that infinite recursion would crash other browser as well. The fact is, that even ie7 is dealing better than webkit in this situation. Also the question is not about helping me, but about being able to catch the RangeError. I don't understand the downvotes... – mreq Commented Aug 20, 2012 at 15:58
  • You didn't post any code. You say there's no recursion, but that's obviously the most likely cause of the problem. – Pointy Commented Aug 20, 2012 at 16:03
  • Well, I am not asking to get a direct solution for my problem, but rather to see, whether it's possible, to catch the error on global scope. That's the question, if you read the last paragraph. – mreq Commented Aug 20, 2012 at 16:06
  • @PetrMarek Sure: try..catch or window.onerror. But, what are you hoping to get out of that other than a solution to the problem? – Jonathan Lonowski Commented Aug 20, 2012 at 16:10
Add a ment  | 

1 Answer 1

Reset to default 5

JavaScript doesn't support Tail Recursion. You're probably calling a function from a function from a function until it blows. (Please post some code to show what you're doing).

Use a setTimeout between 'iterations'. This way you don't block the UI or blow up the stack.

本文标签: javascriptjQuery catch quotRangeError Maximum call stack size exceededquotStack Overflow