www.cryer.co.uk
Brian Cryer's Web Resources

How to hide or change the message displayed in the status bar

Newer browsers (such as FireFox and IE 7) do not allow you to change the status bar. The contents of this article should therefore be regarded as depreciated as it is applicable only to older browsers.

You can configure newer browsers to allow the status bar message to be changed, but this only allows YOU to see it, not your visitors.

In Internet Explorer: Tools → Internet Options → Security tab → Select "Internet" then click on "Custom level ..." → Scroll down and under "Scripting" enable the option to "Allow status bar updates via script" → [OK] → [OK]

In Firefox: Tools → Options ... → Content tab → [Advanced] (next to "Enable Javascript") → Check "Change status bar text" → [OK] → [OK]

Normally when the mouse is moved over a link the status bar changes to display the target (or address) of that link. For example place the cursor over www.cryer.co.uk and the link 'http://www.cryer.co.uk/' is shown in the browser status bar. It is possible (and sometimes desirable) to change this.

Be aware that a growing number of browsers are now configured to prevent JavaScript from changing the status bar message.

Making it work for most browsers

Firstly consider the HTML for the above link:

<a href="http://www.cryer.co.uk">www.cryer.co.uk</a>

To change what is shown in the status bar requires adding an 'onMouseOver' and 'onMouseOut' event handlers. The 'onMouseOver' event handler needs to set the status bar to show what we want and the 'onMouseOut' to clear it. Thus:

<a href="http://www.cryer.co.uk"
onMouseOver="window.status='Cryer Internet Resources'; return true"
onMouseOut="window.status='';return true">www.cryer.co.uk</a>

This produces: www.cryer.co.uk, which shows ''Cryer Internet Resources" in the status bar when the cursor is moved over the link.

Making it work for the rest

Unfortunately if you are using Netscape Navigator version 6 or Opera (or possibly some earlier versions of Internet Explorer) this doesn't quite work! Although no scripting error is reported (because there isn't one) the status bar stays unchanged.

The reason for this is that Netscape Navigator 6 and Opera run the JavaScript before it updates the status line to reflect the URL. In contrast Internet Explorer 6+updates the status line and then runs the JavaScript.

What is required is a means to delay updating the status bar - so that our intended update happens after Netscape Navigator has updated it with the normal URL. This can be accomplished with a simple timeout. A separate function is introduced here in order to keep the logic code event handler code short:

<script language="Javascript">
function TimStatus(message)
{
    window.status=message;
}
function SetStatus(message)
{
    window.status=message;
    setTimeout('TimStatus("'+message+'")',1);
}
</script>

a href="http://www.cryer.co.uk"
onMouseOver="SetStatus('Cryer Internet Resources'); return true"
onMouseOut="SetStatus('');return true">www.cryer.co.uk</a>

This produces: www.cryer.co.uk, which shows "Cryer Internet Resources" in the status bar when the cursor is moved over the link and works equally well for Internet Explorer and Netscape Navigator.

A word of caution: It is often useful for a someone surfing the net to be able to see where a link will take them, so don't over use.