Enhancing Usability with Pseudo Protocols
Often, when enhancing web pages with scripted behaviours, you find yourself creating anchor (link) tags as convenient event triggers. As these links usually have no meaningful
href attribute, they provide little or confusing feedback to the user.
The problem with this is that the status bar now gives no meaningful feedback as to what will happen when the link is clicked.
Screen readers can also struggle with fudged
href links; in some configurations the link text is read in combination with the
href attribute. So having a random or absent
href value in this scenario could make the links quite confusing (see YUI blog article on empty links).
Alternative solution: use a pseudo protocol
By using an intuitively named pseudo protocol in the link
href, we can provide useful tailored information for the user.
For demonstration, I’ve created a generic pseudo protocol named ‘action’ for all scripted event triggers; the following examples illustrate how this would look:
<a href="action: Toggle panel">Would you like to see more?</a> <a href="action: Show slide 2">2</a> <a href="action: Click to process your request, then we'll then redirect you to www.amazon.co.uk">Place order</a>
The status bar now displays helpful information when links are hovered or focused with the keyboard:
Using pseudo protocols in this way means you’ll have to cancel the browsers’ default action when links are clicked, or the browser will get confused because you’re asking it to use a protocol it doesn’t understand. This shouldn’t be a problem in this case, though, as these pseudo protocol links should exist purely as scripted event triggers.
Comments are automatically turned off after 2 weeks