Javascript Links

One thing I find very annoying on web pages is when I click a link to open it in a new tab (middle button), and I find it was a JavaScript link and so nothing happens!

The culprit in question

For example, go to (it was the first one I could find but it is certainly not unique) and middle click on the screen shot of the Ubuntu Website. The desired behavior is to have that image open in a new tab. What actually happens, is that you get a blank page and no image.


This problem is down to the developers. Links with href attributes of ‘javascript:doSomething()’ are old and obsolete ways of working. With new JavaScript libraries such as jQuery, you can set a href as something completely different and still have ‘doSomething()’ run when it is clicked.

What the website mentioned above should have, is the href set to the URL of the image, so that when I middle click the link, the image opens up in a new tab, however it should have a bit of jQuery along the lines of:

$("a.image").click( function(e) {

It isn’t that hard and it would save us all of this aggravation…


Leave a Reply

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

You are commenting using your 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: