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?
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/