javascriptfirefoxfirefox-addonxul

firefox extension status bar overlay run


I am trying to make my first Firefox addon and am struggling a bit.

I have written the javascript code for what I want it to do (window.alert("hello world!")). I have found code to make a thing on the status bar: https://developer.mozilla.org/en-US/docs/Archive/Creating_a_status_bar_extention. Now, I want to make it so that a user can click on the status bar part and it will run my hello world alert. I have spent 3 hours looking and have found nothing.

How can I make my status bar thing run my javascript?


Solution

  • Add an onclick attribute to your statusbarpanel, with the function you want to call. Then make sure the function is defined in a script which is included in your overlay.