Prevent self-linking

It is often the case that a web page links to itself. This can be frustrating for the user, especially if the page takes a long time to load. (This site is guilty of self-linking, but the pages usually load quite quickly.)

Instead of self-linking, a page can suppress links to itself, and at the same time "highlight" the link text in some way, to clearly indicate the current page. The user is able to painlessly answer the common question "Where am I on this site?", at the same time as they are prevented from following a link that is usually useless. Such a style clearly has more compassion for the user's experience.

There are two ways to avoid self-linking in a set of navigation links :

For the dynamic style, there is no standard way to define how such links are suppressed. An implementation might rely on a naming convention, for example, to identify self-linking items that should be altered in some manner.

Example

This example uses WEB4J's HighlightCurrentPage custom tag to dynamically avoid self-linking.

The following JSP snippet appears in a template, and displays a small navigation bar. At runtime, one link in the navigation bar is suppressed, and shows only plain text instead of the full link. In addition, it highlights the text (using a CSS class) to render it more obviously as the current page. This is implemented with <w:highlightCurrentPage>. The tag uses one of two policies to identify links that are to be altered :

<div class="menu-bar">
 <w:highlightCurrentPage styleClass='highlight'>
  <c:url value="/main/home/HomePageAction.do" var="homeURL"/> 
  <A href='${homeURL}'>Home</a>
  <c:url value="/main/rsvp/RsvpShow.do" var="showRsvpURL"/> 
  <A href='${showRsvpURL}'>Rsvp</a>
  <c:url value="/main/visit/VisitAction.do?Operation=List" var="visitEditURL"/> 
  <A HREF='${visitEditURL}'>Visits</A>
  <c:url value="/main/rating/RatingAction.do?Operation=List" var="ratingEditURL"/> 
  <A HREF='${ratingEditURL}'>Ratings</A>
  <c:url value="/all/logoff/LogoffAction.do" var="logoffURL"/> 
  <A href='${logoffURL}'>Log Off</a>
 </w:highlightCurrentPage>
</div>


See Also :
Web usability guidelines
A Web App Framework - WEB4J
Would you use this technique?
Yes   No   Undecided   
© 2010 Hirondelle Systems | Source Code | Contact | License | Quotes | RSS
Individual code snippets can be used under this BSD license - Last updated on June 5, 2010.
Over 150,000 unique IPs last month - Built with WEB4J.
- In Memoriam : Bill Dirani -