ALT Tooltips for Firefox

2005-03-23 13:59 - Greasemonkey User Scripts

Using the Greasemonkey extension for Firefox, we can do many things. This time, let's deal with how incompetent so many web developers are. IE will put the contents of the ALT attribute of an image into a tooltip, even though that's not what it's for. That's what TITLE is for. So, this user script will copy ALT attributes to TITLE attributes, and you can see the contents.


2005-05-01 09:24 - arantius

This script will now effect image maps as well as regular links.

2005-06-01 00:24 - adamv
You could combine the cases by doing: var i=[].concat(document.getElementsByTagName('img'), document.getElementsByTagName('area')); or by doing a document.evaluate on XPath "//img|//area"
Good suggestions
2005-06-01 09:59 - arantius

If you glance at the topic section for GM scripts you can see this is the first one I wrote, and I've learned more XPath more recently. All good suggestions. I might as well incorporate them!

Want support for line breaks
2005-10-02 15:00 - killme2
I encountered a tooltip that has a line break in it, but the script just makes a black bar instead of moving to the next line.
No line breaks
2005-10-02 17:11 - arantius

Too bad killme2, this is impossible. As per bug 67127, Firefox does not do this, period.

tooltips, Titles, and Firefox
2009-09-06 16:21 - bsimrell

This script is great--for me. But what about all the people who haven't installed it? I've added "title=xxx" to some of my site images as an experiment, but that doesn't bring up a tooltip in Firefox. Suggestions?

Post a comment:

  If you do not have an account to log in to yet, register your own account. You will not enter any personal info and need not supply an email address.

You may use Markdown syntax in the comment, but no HTML. Hints:

If you are attempting to contact me, ask me a question, etc, please send me a message through the contact form rather than posting a comment here. Thank you. (If you post a comment anyway when it should be a message to me, I'll probably just delete your comment. I don't like clutter.)