2

I'm using XPCOM, and I want to get the URI of the portion of a page the user clicks (e.g., a user right-clicks on a frame, and I want to display the URL of that frame). So I've set up a mouse listener (nsIDOMEventListener) and then when a click occurs, the handleEvent callback gives me access to the nsIDOMEvent.

My question is, how do I get the URI from the nsIDOMEvent?

Mistalis
  • 17,793
  • 13
  • 73
  • 97
Dan
  • 61
  • 4

1 Answers1

1

To answer my own question: on the event, call getTarget().queyInterface(NS_IDOMHTMLELEMENT_IID).getOwnerDocument(). queryInterface(NS_IDOMHTMLDOCUMENT_IID).getURL()

(The above is pseudo-code. You'll have to adapt it depending on the language you're using)

Dan
  • 61
  • 4