1

I am currently working on Firefox extensions. My extension works as follows:

  1. Whenever user double clicks any word on page(any webpage), the word selected must be stored in a variable and sent to server to find its meaning from database.
  2. When he/she single clicks at any other place in the same document the popup showing meaning from DB should get disposed.

Any Answers?

eyescream
  • 18,088
  • 2
  • 34
  • 46
jyotin
  • 48
  • 8

1 Answers1

0

How do I write a Firefox Addon? is more or less the official "How to get started" question for Firefox addons. I would probably add an event listener to the browser (gBrowser) to listen for click events. The easiest way to make the server call is probably using an XMLHttpRequest. Hopefully that's enough to get you started. Come back with more specific questions when you get stuck. Good luck!

Community
  • 1
  • 1
Tyler
  • 21,762
  • 11
  • 61
  • 90
  • thanks.. matrix i have done exactly the same... only point where problem occurs is when i handle single click the double click handler function never get executed... so tell me any way so that the default nature(single click overriding double click can be postponed or prevented)... Also i am not getting any way so that dynamically added popup cud be disposed after that single click... Thanks again in advance! – jyotin Feb 24 '11 at 10:58
  • Matrix just one change i implemented from your side and it worked well... using gBrowser.addEventListener instead of document.addEventListener.. Thanks a lot.. – jyotin Feb 24 '11 at 11:39
  • Right, because in an extension, `document` is the `browser.xul` document, not the webpage document, like it would be when you're developing a website. As for the single/double click issue, I think similar questions have been asked before. Search around or open a new question... – Tyler Feb 24 '11 at 19:00
  • Matrix...my extension is completely done and its working according to my requirement... Thanks for the Help Dude... – jyotin Feb 25 '11 at 05:58