// shall I write some keywords here to boost search engine ranking?

Saturday, February 19, 2011

JQuery UI: eliminate "stop running this script?" warning in IE

In IE, when the Javascript on the page take too long duration to execute, the browser will popup a warning of "Stop running this scripts?"

In order to eliminate the warning, we need to hint the browser that the script is not infinitely running, by having some pause via Javascript setTimeout method.

However, for Javascript framework such as JQuery that use selector and method chaining extensively, Just setTimeout alone will not help much.

We will need to slice the elements list from selector into few smaller batches, before chain it to the next method.

Below is the sample code snippet:

Feel free to share if you have a more elegant approach to this problem. :)

No comments: