Home > Tutorials > JavaScript Snippets > Creating Blind Links

Creating Blind Links

While I don't really agree with the use of blind links, there are times when you may want to make the URL of a link appear more "user friendly" by providing a description for the link in the browsers status bar.

Blind links are popular with site owners that don't really mind if they trick their visitors, so long as they get some money out of them. In the longer term they can damage the feasiblity of a site. Would you keep on going back to a site if you knew that most of the links on the site pointed to something other than what you were expecting?

Inevitably, there will be some people who want to know how it's done - either to use it on their sites or just to say that they can do it if asked. So here is the code you need to do it.

The code

The code needed to create a blind link has to be embedded into the HTML for each of the links that you want it to apply to.

<a href="real_link.html" onMouseOver="window.status='status bar text';return true" onFocus="window.status='status bar text';return true" onMouseOut="window.status='status bar text';return true">link text</a>

You will need to change the phrase "status bar text" with a phrase or URL of your choice; the example shown above hides the URL real_link.html with the text "status bar text" in the browser's status bar. As you can see, there are three new parts that are added to the link code to achieve the blind link effect.

  • onMouseOver the text to display when the mouse moves over the link
  • onFocus the text to display when the link is in focus (or selected)
  • onMouseOut the text to display when the mouse moves off the link

All three of these attributes need to be applied to the link to completely hide the real URL from the normal browser view. There is no way however to stop your visitors from viewing the source code of the page, which will reveal the real URL you were trying to hide. Don't forget that anyone with JavaScript disabled will also see straight through your link mask.

Please remember, if you do decide to use blind links on your site, not to overdo it and think of your visitors... they may not thank you for it, but they will appreciate it if you don't deceive them.


Noticed a problem or got a question or comment?


This site will look much better in a browser that supports web standards, but it is still accessible to any browser or Internet device.


About this Page

Author: Rosemarie Wise
Originally Published: Mon 28th Jan, 2002
URL: http://websiteowner.info/tutorials/javascript/blindlinks.asp

Want to use this tutorial on your own site? Learn more...


The Web Site Owner's Resource © 2000-2007 Rosemarie Wise