bioneural.net site preferences

Accessibility

Toggle width/ text size:

style

Default/Alternate

Suits visual impairment, mobile devices

Styling

Change the theme:

layout

NB: may reduce functionality

Link behaviour

Links with an icon are off-site:

links

Right-click any link to optionally open in a new window or tab


Identify offsite links in iBlog

It's highly likely your blog contains links to external sites, as well as to other pages within your own site. iBlog gives you the option to open any hyperlink in a new window. It can be useful for users to know in advance whether the link they are about to follow will open a new window and/or take them "offsite". Here is one way to provide this information by applying a CSS rule to your iBlog stylesheet...

This article refers to iBlog (version 1.x), a Mac blogging client that was formerly used to publish this site. It may refer to design elements and other features that have since been replaced.

It is easy to determine which links that you create using the iBlog RTF entry editor should open in a new window:

offsiteiblog
The Add/Edit URL dialog box in iBlog

iBlog uses the "target" attribute to label links that should open a new window:

target="NewWindow"

We can make use of this attribute to create a CSS rule that will apply only to links that open in a new window. For example, we can add a right-aligned icon as a background image (thanks Dan!). The following rule will do this for active and visited links with the target attribute specified, within the class "entry" (you would omit this if you wanted to apply the rule to all such links):

.entry a[target=NewWindow]:link,
.entry a[target=NewWindow]:visited {
padding-right: 15px;
background: url(offsite.gif) no-repeat center right;
}

Click here to replace the current page.

Click here to open a new window.

Tested and works with Safari, Firefox Mac + PC, without invalid XHTML or CSS. Tested and doesn't work with IE6/Win (well that figures!) - but is happily ignored without any adverse cosmetic effects.

2 responses to Identify offsite links in iBlog


  1. 1 James

    Nice, never knew I could do that in CSS. Mind if I use the icon?

  2. 2 Bruce

    James (and others), I don't mind if you use the offsite icon: I merely recreated it using freshly-squeezed pixels from one I found via Google Images.

Something to say?

Comments may be moderated (e.g. no commercial promotion), are subject to spam filtering, and should be relevant to this post—otherwise make contact.

Usable tags include <a href=""> <blockquote> <em>. Select any text and click to quote.