Showing Tooltips in XUL Browser.

Keep the following code in the respective files.

.xul File

<browser id = “browser1″





flex=”1″ />

<tooltip id=”aHTMLTooltip” onpopupshowing=”return FillInHTMLTooltip(document.tooltipNode);”/>

.js File
function FillInHTMLTooltip(tipElement)

var retVal = false;
if (tipElement.namespaceURI == “;)
return retVal;

const XLinkNS = “;;

var titleText = null;
var XLinkTitleText = null;

while (!titleText && !XLinkTitleText && tipElement) {
if (tipElement.nodeType == Node.ELEMENT_NODE) {
titleText = tipElement.getAttribute(“title”);
XLinkTitleText = tipElement.getAttributeNS(XLinkNS, “title”);
tipElement = tipElement.parentNode;

var texts = [titleText, XLinkTitleText];
var tipNode = document.getElementById(“aHTMLTooltip”);

for (var i = 0; i < texts.length; ++i) {
var t = texts[i];
if (t &&\S/) >= 0) {
tipNode.setAttribute(“label”, t);
retVal = true;

return retVal;

technorati tags:, , , ,

Blogged with Flock

Posted in MOzilla. 1 Comment »

One Response to “Showing Tooltips in XUL Browser.”

  1. dvuckovic Says:

    thank you!

    think about going with some tag around your code, because all quotation marks are converted in respective unicode chars, and are causing bugs in xml parser if copy&pasted... but the code works, that's for sure :)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: