Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting a firefox extension when firefox starts up

I wrote a firefox extension to process response and requests. Right now its activated by clicking a menu button. I would like the extension to start running when firefox boots up. Is this possible? Ideally the only interface I want/need to have is inside the add-on manager (disable/uninstall)

Thanks

like image 332
bond425 Avatar asked Dec 15 '25 14:12

bond425


1 Answers

First, register an overlay on browser.xul in your manifest file:

overlay chrome://browser/content/browser.xul chrome://sample/content/sample.xul

Then, include some JavaScript in your sample.xul. This JavaScript should attach an onload event handler to the window. This will fire every time a new browser window is opened and your code will run.

Alternatively, if you need just one instance of your code to be shared among all windows, consider a full-blown XPCOM component, in which you can register to listen for the profile-after-change event, which is one of the earliest events that occurs on startup, after the profile directory and other services have been established.

like image 107
Wayne Avatar answered Dec 18 '25 10:12

Wayne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!