Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
Thank you, this is exactly what I was looking for! –  Superbest Jan 20 at 20:15

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...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.