How to Tell if a Web Page Script Is Taking Too Long to Load

Save

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

  • If you're having persistent problems with the same script, you may consider removing it or replacing it with something more responsive. You can also see improved speeds by deferring scripts so that they load last and don't slow down other elements on the page. Script speed also improved by "minifying" the script, which reduces the size of the JavaScript file by removing white space and blank lines. You can also combine multiple scripts into one file so that the browser only has to load one instance of script instead of four.

References

Promoted By Zergnet

Comments

Resources

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!