Your internet browser may occasionally display a dialog box informing you that it has encountered a long-running script. You may notice the browser running slowly or freezing, and you might have problems loading other websites while the script is running. Educate yourself on what a script is and when to end it.
What Is a Script?
Video of the Day
In most cases, the script that the long-running script message references is a piece of JavaScript code that your internet browser is trying to execute. JavaScript is used to improve your browsing experience as it allows different functionality to be possible on the websites that you visit. For example, JavaScript is used to validate the forms that you fill out on a website as you fill them out. If you miss a required field, you are told right away as opposed to getting an error message after submitting the form. JavaScript also makes animations possible on a website along with many other features. Most scripts run without problem, but sometimes JavaScript may cause an error message to pop up.
Video of the Day
Long-Running Script
Scripts are effectively computer programs, and even small ones can have complexities that result in inefficient execution under certain conditions. This is the case with the long-running script; it is a script that has run into a problem. If the JavaScript file interacts with a database, for example, it can take several seconds to execute. This is considered a long execution time by computer standards, so some browsers may display the long-running script message. Another example occurs when a JavaScript file with many lines of code causes the execution time to be too slow for the browser's standards. Another example is a poorly coded JavaScript file that doesn't stop executing until you manually terminate it. Every internet browser has its own definition of a long-running script and displays a dialog box when it encounters a script that exceeds the browser's allowance for execution time.
Internet Browsers
The way a browser defines a long-running script depends on that browser's standards. Browsers such as Internet Explorer and Microsoft Edge define the script by looking at the number of lines of code the script engine has executed. If the code is more than five million lines, you see a long-running script message. By contrast, Mozilla Firefox, Safari and Google Chrome all look at the length of time that the script engine has been executing. If the script takes longer than 10 seconds, you see the long-running script message.
How to Fix
When your internet browser encounters a long-running script, you see a dialog box on the screen that says the script is running long or may cause your computer to become unresponsive. The execution of the script is paused at this point. You are given a choice to either let the script run or terminate the script. Termination is recommended because if the script can slow down your browser if it is allowed to run. If your browser is unresponsive, press the "Ctrl," "Alt" and "Delete" buttons simultaneously to launch "Task Manager" and then click your browser and select the "End Process" button.