Scripts allow you to create websites with detailed effects and responsive elements, but script errors due to slow loading times cause problems for the visitor. When a script takes too long to load, the browser gives the visitor a chance to kill the script. If you're having trouble with a script on your website, it may be in your best interest to remove or replace it.
Browser Error Messages
If your browser detects that a script takes too long, you'll see an error message or similar warning. It's usually a dialogue that displays which script is taking too long and gives you two options: to kill the script or to wait for the script to finish its task. You'll see these error messages in Internet Explorer, Google Chrome and Mozilla Firefox. Browsers provide the option to kill unresponsive scripts so that users can continue to use the website. If a website hangs on one element, it may stop the rest of the website from functioning.
Testing Page Load Times
If you're working on your own website and are concerned about the loading time, test it using one of the many free tools available. Google's Page Speed Insights is available as an online tool or as an extension for the Firefox and Chrome browsers. It checks performance for both mobile and desktop browsers. Firebug is Firefox-exclusive; it's an entire Web development tool that offers the option to check page performance. Pingdom's website speed test shows the load time and load order of every element on your page, giving you a visual of exactly which scripts slow your page (see Resources).
Penalties of Slow Webpages
The biggest downside to slow scripts is that the browser may crash, while the best case scenario is that the user gets an alert about the unresponsive script and chooses to wait for it to load. However, there are other problems with scripts that slow your page load time. Search engines rank faster pages higher in results. Visitors are more likely to close a website that is unresponsive or takes more than a few seconds to load.
Speeding Up Page Loads
- Microsoft Support: Error Message: "A Script on This Page is Causing Internet Explorer to Run Slowly"
- Ask Leo: What Should I Do When My Browser Tells Me a Script Is Unresponsive?
- Web Designer Depot: How to Speed Up Your Website Load Times
- WebProNews: How Page Load Speed Impacts SEO And User Experience