Something similar to this came up at work last week and I think it
would be good to tack it on to this thread (hopefully there's enough
relevance!).

The problem was that we wanted to handle links to non-html files in a
different manner than regular links. Ideally, it shouldn't require any
more effort from the content author.

The following page shows a simple demonstration of the solution:
http://leftjustified.net/lab/javascript-file-links/

By splitting it into a switch/case, you can have different
behaviour/style/etc for each file type. A good example might be
redirecting all mp3 links via a site's Flash audio widget if Flash
(and js) are present. Another useful addition would be to check if the
link is the sole child element of an <li>, in which case you may want
a large icon to the left (see demo page) or if it's the child of a
paragraph, you may want a smaller icon on the right... All without the
author even considering that they are linking to a file that could
potentially load external apps/plugins.

In a controlled input situation (eg: a web developer's blog), a
solution like Patrick Lauke's 'type' link styling expermient (
http://www.splintered.co.uk/experiments/38/ ) adds more useful info to
the markup and can be used the same way; but when a client is in
control of the content you set up whatever automated help you can and
cross your fingers ;D

Cheers,
Andrew.

On 7/30/05, Thierry Koblentz <[EMAIL PROTECTED]> wrote:
> > A more reusable approach would be to check for '://', as this is what
> > differentiates 'mailto:', relative paths and 'http://' links, but will
> > still allow you to use the script on secure pages.
> > Whenever dealing with href maniputlation, it's always good to keep
> > 'https' in the back of your mind ;)
> 
> Nice catch!
> 
> > Other than that, it looks like a great approach for sites with client
> > controlled content.
> 
> Thanks Andrew,
> 
> Thierry | www.TJKDesign.com
> ******************************************************
> The discussion list for  http://webstandardsgroup.org/
> 
>  See http://webstandardsgroup.org/mail/guidelines.cfm
>  for some hints on posting to the list & getting help
> ******************************************************
> 
> 


-- 
--------------------------------
http://leftjustified.net/
******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to