How to start using privileged chrome.

This is a guide to how to start with testing a chrome XUL application.

  1. Create a directory somewhere on your disk. Many people put this as a subdirectory inside Mozilla's chrome directory, but this isn't necessary. The directory could be anywhere and on any disk. Put your XUL files in this directory.
  2. Create a file called contents.rdf and place it in this directory. Copy the text in the box below into the new contents.rdf file. This file is used to identify the application id, its name, author, version and so on.
  3. <?xml version="1.0"?>
    <RDF:RDF xmlns:RDF=""
      <RDF:Seq about="urn:mozilla:package:root">
        <RDF:li resource="urn:mozilla:package:myapplication"/>
      <RDF:Description about="urn:mozilla:package:myapplication"
              chrome:displayName="Application Title"
              chrome:author="Author Name"
  4. Change the highlighted parts of the file above to your own information. The red text 'myapplication' should be the ID of your application. You make this up, but typically, the ID is similar to your application's name. Replace the blue highlighted text above with your application's title and author.
  5. If the 'chrome:extension' field is true, the application is a Mozilla Firebird Extension and it will show up in the Extensions window of the browser. If false, it will not appear.
  6. Save the contents.rdf and make sure it is in the directory you created in step 1.
  7. Open the file <mozilla-directory>/chrome/installed-chrome.txt, where <mozilla-directory> is the directory where Mozilla is installed. Exit Mozilla before you do this.
  8. Next, you are going to register the new application with Mozilla so it will know where to find it. Add a line at the end of installed-chrome.txt pointing to the new directory you created in step 1.
    Change the highlighted text to the file URL of the directory. Make sure that it URL ends with a slash and that you press enter at the end of the line. If you aren't sure what the URL is, open the directory created in step 1 into a Mozilla browser and copy the URL from the location field. Note that the reference should always be a directory, not a file.
  9. Delete the file <mozilla-directory>/chrome/chrome.rdf.
  10. Start Mozilla. You should be able to view any XUL files you put into the directory using a URL of the form: chrome://applicationid/content/file.xul where file.xul is the filename. Your main XUL file should be applicationid.xul which you can load using the shortcut URL chrome://applicationid/content/.

If you are creating skin and/or locale portions, repeat the steps above, except that the format of the contents.rdf file is slightly different. Look at the contents.rdf files in other applications for details.


Copyright © 1999 - 2005