What userChrome.css is for CSS customization, userChrome.js is for JavaScript. Simply edit the file userChrome.js (in the same place as userChrome.css) and its content will be run whenever a new chrome window is opened (onLoad).
Download
<a href="http://mozilla.zeniko.ch/userchrome.js.xpi">userChrome.js 0.8</a>
This release should work for Firefox and Thunderbird 2.0 as well as version 1.5.0.7 and later and all Gecko 1.9 applications such as Firefox 3 nightlies.
Update from version 0.7
If you're updating from version 0.7, please add the following line to the top of your userChrome.js before restarting Firefox or else your code will be run in places you might not expect:
Code: Select all
if (location != "chrome://browser/content/browser.xul") throw "stop";
(obviously you'll want to replace that URL for applications other than Firefox)
Snippet collections
<li>The original userChrome.js snippet collection
<li>A growing collection of snippets by the author of the ScrapBook extension
<li>Snippet collection from the MozillaZine Knowledge Base
<li>Snippets collected by Pirlouy from the original userChrome.js thread
Revisions
~~ 0.8 ~~~~
<li>userChrome.js is now run for every chrome window, not just the main one
<li>Suggested for inclusion into one of the next Firefox versions (see bug 332529)
~~ 0.7 ~~~~
<li>Added support for most current Gecko applications
~~ 0.6 ~~~~
<li>The file userChrome.js is automatically created
~~ 0.5 ~~~~
<li>Initial release (2006-01-24)