Friday, June 03, 2005

Displaying link types in Firefox

Ever been to a site and found that you're launching a link in new window without warning, or downloading a link to content that then starts another application like Acrobat or Word without you realising?
If you use Firefox, you can alert yourself to these sorts of links by editing your user stylesheet: userContent.css. This can be found within the chrome folder for your profile. Typically for Windows users this is located in: C:\Documents and Settings\[username]\Application Data\Mozilla\Firefox\Profiles\[eight-digit].default\chrome\. Note that you will need to view hidden files to browse to this directory. From your document window menu select Tools > Folder Options > View > Show hidden files and folders.
This file is unlikely to exist yet, so here's one I made earlier. Right-click on the link, choose Save link as... and save it to the relevant folder.
If you then edit this file you'll see where I've made some changes. The bulk of work, changing cursors to flag up where target links change was done by Chris Pedrick. My bit is for different content link types. You can use this as a basis for altering other sorts of links, if you know css. For example, this line finds where there's a PDF extension in a link, creates some space to the right of the link and puts a PDF icon there.
a[href$=".pdf"]
{padding-right: 17px; background: transparent url(http://www.site-moliere.com/images/icon_pdf.gif) no-repeat top right;}
a identifies the link as in a normal stylesheet, while the element in square brackets identifies the type of link. This is a really simple tool that you can manipulate and extend it yourself to suit your needs, so have a play around. Note that you'll need to shut down and restart Firefox each time you make a change.

No comments: