Monday, December 25, 2006

How to automatically install a button onto FireFox Toolbar?

Here are some facts about rdf:local-store in Mozilla architecture from XULPlanet:

  • The datasource rdf:local-store is included with Mozilla and is used to hold state information such as the position of the browser window, which columns in tree views are displayed, and which toolbars and sidebars are displayed.
  • This information is saved when Mozilla exits, and is re-applied automatically to the XUL content when the appropriate window is opened again.
  • Although the local store normally holds XUL state information, you can actually put anything you want into it.
  • The local store is saved to an RDF/XML file 'localstore.rdf' in your Mozilla profile directory. Since it's an RDF/XML file, you can open it in a text editor and view the information it contains. It's possible to modify the file as well, although that isn't
So the answer to our question on how to add a button to the browser's toolbar lies in the localstore.rdf file. Open the file and find the triple, or assertion, on chrome://browser/content/browser.xul#nav-bar and you should be able to see something like this:

Just add your toolbar 'ID' to the currentset and you're done.

No comments: