A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive.


Your get one of these errors when running Internet Explorer:
Stop running this script?
A script on this page is causing Internet Explorer to run slowly.
If it continues to run, your computer might become unresponsive.


“A script on this page is causing Internet Explorer to run slowly.  If it continues to run, your computer may become unresponsive.” “Do you want to abort the script?”


Explanation:
When Internet Explorer runs more than 5 million lines of script, you will get this error.  If you choose to continue, the counter is reset and after another 5 million lines of script, you will get the error again.


Workarounds:
Reduce the number of iterations/statements in the code.  If you run Process Monitor and see what registry keys are read, you will see a client side registry key related to lines of code but this is not practical to use because you would not be able to push this registry setting down to all clients.  Also, since it is not documented, it is not supported.


Sample to create the problem:


<html>


<head>


</head>


<script language=”javascript”>


    var totCount=0;


    function loopy()


    {


          // i – 100K iteration loop


          for (var i=0; i<100000; i++)


          {


              jloop();


          }


          alert (totCount);


    }


 


    function jloop()


    {


          // 10 iterations (1 million total with this)


          for (var j=0; j<10; j++)


          {


              kloop();


          }


    }


 


    function kloop()


    {


          //k – 5 iterations


          for (var k=0; k<5; k++)


          {


              totCount++;    


          }


    }


 


</script>


 


<body>


<input type=”submit” name=”btn_Login” value=”Login” onclick=”loopy(); “ language=”javascript” id=”btn_Login” />


 


</body>


</html>


 

Comments (11)

  1. Simon says:

    On IE6, 70000 lines javascripts will pop the dialog, could u explain it?

    thanks,

    Simon.

  2. Jeff Sanders says:

    I should have qualified the statement better.  This would be the statement count not the line count.  You can have more than one statement on a line.  Also you may be suffering from some sort of recursion.

  3. Anonymous says:

    Yes, this is indeed a problem.  So is there a solution besides editing the registry?

  4. Jeff Sanders says:

    There is a solution besides editing the registry: "Workarounds:

    Reduce the number of iterations/statements in the code."

  5. karen morse says:

    i dont know how to stop a long running script internet is very slow

  6. Jeff Sanders says:

    Hi Karen,

    If you are the developer of the web page you can take the steps outlined in this post.  If you are not the developer you have to contact the owner of the page and let them know the page needs to be fixed (and point them to this article).

    -Jeff

  7. psmcbrayer says:

    Wow. Let's let Facebook know how crappy they still are… they always have some sort of problem these days. It is the only site I am having problems with Explorer and getting these error messages.

  8. Jeff Sanders says:

    Hey P,

    It would be great if you would give FB some feedback here: http://www.facebook.com/help

    -Jeff

  9. Katrina Childress says:

    A script on this page is causing my computer to run slow.I need help rite now!

  10. Jeff Sanders says:

    Hi Katrina!

    If you are the developer of the web page you are having touble with, you should be able to follow this blog post to resolve your issue.  If you are not the developer of the web page or not a web developer, you probabably will not understand this post… however in short, the person who created the web page/web site needs to fix the problem they caused.  You can contact them to fix it because it is not put together very well!  Often on pages there is a feedback link or contact us link at the bottom.

    -Jeff

  11. RMcNeil says:

    My script is in Facebook and internet Explorer..Went to Mr Fix It for get it will not even let me load.  No help from anyone so by by internet….Yes they should fix the problem but why would they when we just keep paying. and nothing gets done.