I want Firefox to scan every page, and for every <a href="URI">Text</a> element, I want Text to be replaced with Text [PDF] if URI point to a PDF file (similar to Google Scholar results).

This is because I have Firefox configured to open PDFs externally, and I am annoyed by the extra blank tab from attempting to open them in a new tab, and the popup dialogs are an unwelcome surprise.

If possible, I would like it to automatically do this for every file that is configured to be opened with an external application under Options -> Applications.

I don't need any advanced logic - just a simple regex match for \.(pdf|PDF)$ would suffice, but a smarter method would of course be even better. It would also be nice if it didn't append the [PDF] when it's already appended, such as on the Google Scholar page, to avoid redundancy.

Ideally I'm looking for a Firefox extension.

2 Answers 2


You could use Greasemonkey and a user script. User scripts are scripts that you install in Firefox and that can run on any webpages to do things.

You could install for example: http://userscripts.org/scripts/show/8615 - automatically adds icons to non html files (pdf and other):

enter image description here

You will need to install the Greasemonkey extension before installing a user script. (on the userscript site, go to "How do I use this?" under the "Install" link.)

There may be other scripts that only do pdf links.


Another option would be to edit your user agent style (.css), and add a rule that matches <a href="*.pdf" elements, and style them with a background of a pdf icon, or highlight them...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .