Steve Trefethen
Contact me
About Me View my LinkedIn profile

Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?
Need consulting?
Need Consulting?

Disclaimer

The posts on this weblog are provided AS IS with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Adding support for image icons which denote offsite links

April 10 2007 6:21AM
One of the improvements I've been wanting to make to my blog theme is support for icons next to URL links which indicate if the link is offsite, meaning that it'll cause you to browse to another domain. As you can see from this search there are lots of different approaches largely because not all browsers support the latest standards. For the time being I've opted for a CSS only solution which means it's only supported in Firefox (2.0 is what I've tested) and IE7. IE6 and less will continue to render the links normally without any offsite icon indicator. I've opted for this route because it was really easy to add the following CSS.
1 #centercolumn a[href^="http://"] { 2 background: url(/blog/themes/stevewhite/images/external.png) 3 no-repeat center right; 4 padding-right: 13px; 5 } 6 #centercolumn a[href^="http://www.stevetrefethen.com"], 7 a[href^="http://stevetrefethen.com"] { 8 background: transparent; 9 padding-right: 0; 10 }
This means that offsite links appearing only in the center column will be denoted with an icon like this offsite link icon. Supporting IE versions < 7 is a bit more involved than I have time to spelunk. I came across the above solution by digging into the theme used for MediaWiki which is the wiki engine the Delphi R&D team uses. It has a solution for IE6 but it's more involved than I care to dig into. On my blog, IE7 usage has eclipsed IE6 (50% to 44%) so it's a matter of time before this becomes a non-issue anyway. Regardless, if someone has a simple solution that works for IE6 which they'd like to share I'd be more than happy to add it.

Tags: , ,

Comments

4/10/2007 9:18:35 AM #

Fernando Madruga

A few notes:

1) The CSS is being cropped on the right.
2) Sometimes when I try to post a comment, there's a box requesting the code and no image for it.
3) I've just noticed that, while posting this comment, the comment box runs over the "Navigation" box on the right... Don't remember this happening before...

Notes:
1) Took some PRT-SCRs if you cant to have a look.
2) Using Firefox 2.0.0.3

Fernando Madruga

4/10/2007 9:20:53 AM #

Fernando Madruga

Typos in previous comment:
"cant to have a look" => "want to have a look";
"CSS is being cropped" => "CSS listing is being cropped".

Usually check what I type, but was distracted by the "side-effects"! Smile

Fernando Madruga

4/10/2007 2:53:34 PM #

Steve Trefethen

Thank Fernando, I had left some of the bits from my experiments trying to get the icons to work on IE6. Regarding the CAPTCHA control I've seen similar problems on other blog engines in Firefox as well. For example, I have to use IE to post comments on blog.codegear.com since I can't see the image in FF.

Steve Trefethen

4/13/2007 8:14:53 PM #

Vegar Vikan

Naturally, your external link-icons shows correctly in Opera too, at least in version 9.20 that I use.

Vegar Vikan

4/13/2007 10:26:56 PM #

Steve Trefethen

Hi Vegar,
  Good to know as Opera is not one of the browsers I test with.

Steve Trefethen

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Spam filtering provided by: Spam Counter
341 comments approved, 1535 spam caught since October 28, 2009
Powered by Commentor