Internet Explorer 7, JavaScript, and Array Limits

I came across this a week or so ago while at work. It turns out that there is a limitation on Microsoft's implementation of javascript in IE7, but not one too many people might run into.

It comes in regards to array allocation. Whereas IE6 had no limit on the amount of array elements that could be allocated in memory, IE7 has a limit of about 8000 array elements. I'm not sure of the exact number, but that's usually about the point we were getting our cryptic "syntax error" messages. And to clarify, that's about 8000 total array elements in one page, not just in one array.

The good news is that you can get around this problem by using table objects instead of array objects. While a little more complex to work with in javaScript, they don't have any size limitations and can still get the job done.

Comments
Shantanu's Gravatar Hi,

Me too is having problem in populating select control while adding and removing options from from array object. Its simply showing the 'Syntax Error' to me where i was trying to create array as new array()

Please suggest, any workaround if you have for this problem.

Thank You

Regards,
Shantanu
# Posted By Shantanu | 6/19/07 5:55 AM
Greg Nilsen's Gravatar

Shantanu,

You might have missed it at the bottom of my post, but I suggest using table objects instead of arrays for your objects.  In many cases, they can be used similarly, but it does call for a complete code rewrite.  If you have a two dimensional array, just think of the row objects as your first dimension, with your cell objects as your second dimension.  However, if your array needs to have more than two dimensions, then even this solution isn't going to help you much.

Good luck! 

# Posted By Greg Nilsen | 6/19/07 10:51 AM
dereje jagema's Gravatar thank you my bestfor you help .but why you easly provide a source.i think this way helps more than people.
# Posted By dereje jagema | 6/29/07 7:53 AM
Greg Nilsen's Gravatar Sorry, the only code I have was very application specific (for ColdFusion), and of a proprietary nature.  I couldn't share it if I wanted to, and I'm not sure it would help most people if I did.
# Posted By Greg Nilsen | 7/4/07 4:11 PM
tc's Gravatar And under the newly released IE8 Beta 1, it is now working again.
# Posted By tc | 3/7/08 6:20 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9. Contact If Jesus Had A Website