If you need the _escaped_ URL, try this:

(doc is the document provided by DOMContentLoaded, but just using
content.document should be fine as well)


// Attach listener
doc.addEventListener("mouseover", rdr.catchMouseOver, true);

// This returns false if there's no link or the href itself (will bubble up)
catchMouseOver: function(event) {
    e=event.target;

    while(e && e.docName!="#document") {
      if(e.href && e.href.length>0) {
        return e.href;
      }
      e=e.parentNode;
    }
    return false;
},


Other than that, I don't know a good way to get the URL. You can still
hack into available functions and inject some kind of listener there.
This is what I use for RDR to add "RDR:" in the statusbar, if there's
a redirect:

if(nsBrowserStatusHandler) {
      
eval("nsBrowserStatusHandler.prototype.setOverLink="+nsBrowserStatusHandler.prototype.setOverLink.toString().replace(
      'link;',
      
'unescape(rdr.findLink(rdr.overLink))==link?unescape(rdr.cleanLink(rdr.findLink(rdr.overLink),true)):link;'
      ));
    }

Anyway, if you just want some kind of listener I'd just replace the
last } and inject your function like this:

if(nsBrowserStatusHandler) {
  
eval("nsBrowserStatusHandler.prototype.setOverLink="+nsBrowserStatusHandler.prototype.setOverLink.toString().replace(
      '}',
      'giveLinkToMyExtension(link); }'
      ));
    }

Haven't tested though, so good luck :)


On 2/4/07, Amin <[EMAIL PROTECTED]> wrote:
> ok
> this code works correctly:
>
>
> window.addEventListener("mousemove", StatusCorrect,false);
> function StatusCorrect(e){
>        var sStatus = document.getElementById("statusbar-display");
> }
> but
>
>
> window.addEventListener("mouseover", StatusCorrect,false);
> function StatusCorrect(e){
>        var sStatus = document.getElementById("statusbar-display");
> }
> does  not work
>
>
> On 2/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > It looks like your code was clipped. Please re-post.
> >
> >
> >
> >
> > ----- Original Message ----
> > From: Amin <[EMAIL PROTECTED] >
> > To: Mozdev Project Owners List <project_owners@mozdev.org>
> > Sent: Saturday, February 3, 2007 3:28:21 PM
> > Subject: [Project_owners] Javascript Q
> >
> >
> > Javascript Q?
> >
> > i want to get URL of links in page it is possible by :
> >
> > window.addEventListener("mouse... StatusCorrect,false);
> > var sStatus = document.getElementById("statu...
> >
> > sStatus.label is link URL
> >
> > but when i want to use this code instead :
> >
> >
> > window.addEventListener ("mouse... StatusCorrect,false);
> > var sStatus = document.getElementById("statu...
> >
> > sStatus.label is empty ,i think it is because that mousemove is before
> creating status bar information ,any body know what i must do ?
> > _______________________________________________
> > Project_owners mailing list
> > Project_owners@mozdev.org
> > http://mozdev.org/mailman/listinfo/project_owners
> >
> >
> > _______________________________________________
> > Project_owners mailing list
> > Project_owners@mozdev.org
> > http://mozdev.org/mailman/listinfo/project_owners
> >
> >
> >
>
>
> _______________________________________________
> Project_owners mailing list
> Project_owners@mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>
>
_______________________________________________
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to