Welcome, Guest

Can This Prevent 'Stop running this script' in IE
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Can This Prevent 'Stop running this script' in IE

Can This Prevent 'Stop running this script' in IE 1 year, 5 months ago #16355

I keep getting the 'Stop running this script' message in Internet Explorer and no were else. My form can't be reduced in size and I only have a couple visibility rules.

However, I did find this...
http://www.picnet.com.au/blogs/Guido/post/2010/03/04/How-to-prevent-Stop-running-this-script-messagehttp://www.picnet.com.au/blogs/Guido/post/2010/03/04/How-to-prevent-Stop-running-this-script-message-in-browsers.aspx

the simplest solution is to just break up your task into mutliple smaller tasks with a setTimeout in between these tasks. The utility class below does just this:

Utility Class

RepeatingOperation = function(op, yieldEveryIteration) {
var count = 0;
var instance = this;
this.step = function(args) {
if (++count >= yieldEveryIteration) {
count = 0;
setTimeout(function() { op(args); }, 1, [])
return;
}
op(args);
};
};

So how do we use this class, lets say we have the following code which is giving us a jerky browser and occasionally displaying those horrible 'Stop running this script' message:



// initdata is just an array of numbers (a very very large array)
var test1 = new Array(initdata.length);
for (var i = 0; i < initdata.length; i++) { test1[i] = initdata[i] * 2; } // Double each item in the initdata array
continueOperations();

To use the utility class above we would change the code to this:



var test2 = new Array(initdata.length);
var i = 0;
var ro = new RepeatingOperation(function() {
test2[i] = initdata[i] * 2;
if (++i < initdata.length) { ro.step(); }
else { continueOperations(); }
}, 100);
ro.step();

That's it, a little bit more code, an extra closure, so not pretty but I think a relativelly stylish solution to a nasty problem. Note: Remember this will also give you a much more responsive browser during execution of this expensive code also.



I'm not a code guy so I don't know how to implement it. Could someone more knowledgeable give me a hand?
  • paco2paco3
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0

Re: Can This Prevent 'Stop running this script' in IE 1 year, 5 months ago #17224

To the moderator: We are also having this problem on our form. You can see the error for yourself if you need to. Go to "192.168.10.47/joomla". With IE as your browser, go to the change form link. On laod, the script error stuff will happen. No other browsers, but as we know, IE is still (why I don't know) the most popular browser, so if this can't be remedied with IE, we can't use the software.

We attempted to get to the actual code from the form we built with the quickform editor and insert pauses as recommended elsewhere on this site, but there doesn't seem to be a way to obviously do that.

Any help from admins or moderators would be returned with the utmost gratitude.
  • kadavila
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0

Re: Can This Prevent 'Stop running this script' in IE 11 months, 3 weeks ago #28905

I have this problem too. Help would be appreciated. Thank you.
  • rokada
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
  • Page:
  • 1
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.28 seconds

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany