Your Web browser may occasionally display a dialog box informing you that it has encountered a long-running script. Very likely you'll notice the browser running slowly or freezing and you might have problems loading other websites while the script is running. This error message is often seen with Internet Explorer, but other Web browsers will display their variants of the message as long-running scripts affect every Web browser. Despite the alarming appearance of the message, a long-running script is simply one that is suffering performance issues and running beyond that browser's permitted execution time or lines-of-code threshold.
Scripts are computer programs and even small ones have complexities that can result in inefficient execution under certain conditions. There are many reasons why a script could be long running. If your script interacts with a database, it can take seconds to execute, which is a very long time by computing standards. If the programmer has written many lines of code, this can also slow down the execution time. If the programmer has coded in an unending loop, the script may not stop executing until you manually terminate it. Each browser has its own definition of a long-running script and will display a dialog box when it encounters a script that exceeds its execution thresholds.
Internet Explorer defines a long running script by looking at the number of lines of code that the script engine has executed. The default value is five million lines of code, over which it deems the script long running and will prompt you to take action. You can change this value in your computer's registry setting. Firefox looks at the length of time that the script engine has been executing. If it is longer than ten seconds, it deems the script to be long running. The Safari and Chrome browsers also check your script's execution time to determine whether it is long-running.
When your Web browser encounters a long-running script, it will pause execution of the code and display a dialog box telling you that a script is running long or may cause your computer to become unresponsive. You can either choose to let the script continue executing, debug it on some browsers or terminate (kill) the script and resume using your browser. You can change your registry setting for Internet Explorer to increase the threshold. Firefox lets you change the timeout threshold in its "about:config" settings. If you're the one writing the script, be sure to test its performance across different browsers before deployment.