Microsoft Internet Explorer and Java Loops

Microsoft Internet Explorer and Java Loops
Page content

JavaScript - Facilitator of Rich Web Content

In order to deliver varied content and functions to web pages, website developers employ scripting. One such scripting language used is JavaScript, useful for many varied purposes such as signing a website visitor into their account or adding up numbers entered into a form.

Although useful, if used on a live website without sufficient testing, JavaScript can turn out to be a performance issue, locking up some versions of Microsoft Internet Explorer thanks to poorly executed loops.

In situations such as this, the only real escape from the loop is to close the browser – this might have some impact on your work, as well as the performance of your computer, so avoiding such loops is vital.

(Screenshot by author)

Why a Poorly Written JavaScript Loop will Crash Internet Explorer

Use of a badly written script with inadequate testing in a web page will lead to the browser crashing for various reasons. For instance the web page might have multiple JavaScript functions that refer to each other, and poor testing might lead to one of the scripts reacting poorly to a bad reference.

When the web page reaches the second script and has to refer back to another, this is when the loop can occur. This might manifest in various ways but the general effect is that the browser window will become unusable, possibly with a “(Not Responding)” message across the top.

So how do you prevent this from occurring? The trick obviously would be to not visit such a web page, although if you knew what was on the page before visiting then you wouldn’t bother to click the link…

Exiting a Frozen Internet Explorer Window

There are two ways you can exit Internet Explorer if it appears to have frozen. The first is to go to the X symbol in the top right-hand corner and click this. If it doesn’t respond, find Internet Explorer in the Windows taskbar, right-click and select Close window.

If this fails, press CTRL+ALT+DEL (or right-click the Windows taskbar) and select Start Task Manager. Internet Explorer should be listed in the Applications tab, and all you need to do here is select the application with a left-click and then use the End Process button to close the browser. This may take a little time to complete.

Why Modern Browsers Avoid the Issue

Most of the events described above should only occur on an older browser. If you’re running Internet Explorer 7 or later then issues with JavaScript loops (or indeed any other scripting) shouldn’t affect your browser thanks to various security features that have been included. Some versions of the browser will give you the option of enabling and disabling JavaScript.

For instance if a web page is running a script that is taking too long to respond, Internet Explorer will advise you of this fact, and give you to option to stop the processing of the script.

As badly-written JavaScript loops lead to Internet Explorer being caught in a never-ending munching of system resources, having such a time limit in place in the browser is a great way to protect surfers from this occurring.


Author’s own experience