Why you shouldn’t use LinkButtons

ASP.NET has a LinkButton control, which looks like a link but works like a button. Almost.
ASP.NET Linkbutton

Generally speaking, when you hover over a link in your browser, you get to see the URL of the link, so you know where you’re going. With a LinkButton, however, you get gibberish.

Normal link LinkButton
Normal link LinkButton

Right-clicking a link gives users a range of options for doing what they want with that link. A LinkButton doesn’t allow this – it looks like a link, but it doesn’t work like one. Not doing things like your users expect leads to confusion.

Normal link LinkButton
Normal right-click LinkButton right-click

In some browsers, you can middle-click to open up a link in a new tab. Personally, this is something I use all the time. Indeed, there’s even a Firefox extension, SubmitToTab, which lets you do the same thing with a button. LinkButtons, however, break this, and break it badly. It’s not that it doesn’t work, but it also sends you to a blank page with gibberish in the address bar.
LinkButton middle-click

Now, granted, so far, everything’s working as though it was a button, not a link – and a LinkButton is supposed to be a button, after all (which happens to look like a link). However, a user expects that if it looks like a link, then it will be a link, and behave like a link, and vice versa. Putting actions behind (what looks like) a link is dangerous because users might not realise that they are committing an action. If it’s supposed to be a button, why use what looks like a link? You’ll just confuse things!

Anyway, most of the sites that I’ve seen using LinkButtons have been using them for what is, effectively, navigation.
LinkButton used for navigation

None of that, however, compares to the big weakness of LinkButtons – and that is Javascript. Using a LinkButton unnecessarily requires Javascript to be enabled in the user’s browser. Otherwise, they end up getting a Page Not Found error message when they click it!

Some percentage of your users will have Javascript disabled. Perhaps they’re using a mobile phone or PDA which doesn’t support Javascript, or using NoScript, or maybe it’s company policy to disable Javascript on Internet Explorer (and, frequently, this can’t even be changed by the users). Do you really want to stop all these users out from using your site?

There are alternatives. For example, if you have a button, and, for some reason, you absolutely need to display it as a link, you could use a little CSS magic to get pretty much all of the way there. The results work without Javascript and will degrade even if CSS is disabled (unlikely) or the user is using a browser that predates CSS (it will just look like a button).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: