Hide Actual URL From Status Bar For All Browsers

Posted on December 30 2009 by Mehedi.com.BD

Old technique to display hide actual URL  in the status bar

If you search in google with the keyword change status bar text , you’ll find that many codes in different websites which are using window.status to change the text of the status bar while mouse is over the link. For example,

<a href="http://www.mehedi.com.bd/?id=225" onMouseOver="window.status='http://www.mehedi.com.bd';
return true" onMouseOut="window.status=''">Click here </a>

The above link displays “http://www.mehedi.com.bd” instead of “http://www.mehedi.com.bd/?id=225″ in the status bar when mouse is mover the hyperlink. But, the main drawback of above code is that it only works in Internet Explorer(IE) . It doesn’t change the status bar text of the link in any other browsers like “Firefox”, “Safari” etc.

How to display diferent URL of links in status bar of Firefox , Safari etc ?

To change the satus bar text of the the link in firefox and safari you’ve to just use a small technique with the help of “href” and “Onclick” attribute of the hyperlink. Let’s look at the this technique step by step,

  1. First, make a javaScript function and define it exactly as below,
        <script language="javascript" type="text/javascript">
         function redirectURL(URL)
         {
           document.location=URL;
           return false;
         }
        </script>
  2. Now, define the hyperlink with the status bar text in href attribute and call the above function from onClick attribute of the link like below,
    <a href="http://www.mehedi.com.bd" onclick="return
    redirectURL('http://www.mehedi.com.bd/?id=225');">Click here</a>

As we know the we see the text in status bar which is defined in the href attribute of the hyperlink. And when you click the link, code within onclick event of element is called. We’ve taken the benefit of this phenomenon to show the different text .

But remember, this technique also have a drawback as it doesn’t work if JavaScript is diabled in the web browsers.

Leave a Reply