4

While fetching quite a large Backbone collection from a REST service with IE8 I encounter a "A script on this page is causing Internet Explorer to run slowly" warning message.

I have around 25 properties of 4000 items (this is an intranet app, I do paging client side).

All the other browsers (IE9 too) work perfectly.

The warning appears when the received rest array is mapped to the collection of models after a fetch to the server.

This message appears as IE8 has a limit of around 5 million operations and it shows an annoying warning message when it reaches it.

I don't know how I can reach this limit with what it appears to me not a really huge amount of data.

I've learned that this limit can be increased by manipulating the windows registry on the client or with a patch Microsoft provides.

A more elegant solution is to use a workaround as described here that will insert a setTimeout on long running operation resetting the operation counter in IE8.

Now after the successful fetch of the data, backbone calls the parse method that will use internally the underscore.js map function.

I'd like to apply the workaround code without touching the underscore.js or backbone.js source code. Is this possible?

Community
  • 1
  • 1
Ronnie
  • 4,959
  • 10
  • 51
  • 69
  • 2
    Makes the most sense to just override the parse method. If you're already doing that, you can add that workaround code there. – Brendan Delumpa Jul 31 '12 at 22:18
  • +++1 Great Question, well phrased, well researched....Same problem. Did you consider simply overriding the backbone methods in your extensions? Did you ever solve this? – Chris Pfohl Mar 01 '14 at 18:53
  • I fallowed the suggestion from the accepted answer as parsing too many rows on the client was not suitable for IE8. I used pagination and moved all the filtering stuff server side. Until Microsoft doesn't decide to really kill IE8 we will have costumers using it... – Ronnie Mar 02 '14 at 07:46

1 Answers1

1

Is it possible to split the request and let the server frontend do all the pagination logic? IE8 is hell, really, but your approach isnt best practice either, intranet or not. 4000 objects x 25 properties (json i guess, as you're using backbone) is actually pretty heavy client side parsing.

Check out the Backbone.Paginator component for Backbone as it will most certainly help you out.

http://addyosmani.com/blog/backbone-paginator-new-pagination-components-for-backbone-js/