MozillaZine

Overlays

From MozillaZine Knowledge Base

(Difference between revisions)
Revision as of 16:25, 14 November 2004
Mozcerize (Talk | contribs)

<-- Previous diff
Revision as of 23:45, 22 November 2004
Asqueella (Talk | contribs)

Next diff -->
Line 4: Line 4:
===Specifying overlays when developing extensions=== ===Specifying overlays when developing extensions===
-Information about overlays should be specified in a contents.rdf file inside the same folder as any XUL overlay. For example, if you have a file content/myextension/myOverlay.xul in myextension.jar which overlays the file content/mozapps/downloads/unknownContentType.xul in <mozilla install directory>/chrome/toolkit.jar then you should include the following two things in myextension.jar/contents/myextension/contents.rdf.+Information about overlays should be specified in a contents.rdf file inside the same folder as your overlays. For example, if you have an overlay in content/myextension/myOverlay.xul in myextension.jar which overlays the chrome://browser/content/browser.xul location (<install directory>/chrome/browser.jar/browser/content/browser/browser.xul file), you should include the following two things in content/myextension/contents.rdf:
-Add the line+<ol>
- <RDF:li RDF:resource="chrome://mozapps/content/downloads/unknownContentType.xul"/>+<li>Add the line
 +<pre><RDF:li RDF:resource="chrome://browser/content/browser.xul"/></pre>
inside the tag inside the tag
- <RDF:Seq RDF:about="urn:mozilla:overlays">+<pre><RDF:Seq RDF:about="urn:mozilla:overlays">
- </RDF:Seq>+</RDF:Seq></pre>
(Create this tag if it doesn't already exist.) (Create this tag if it doesn't already exist.)
 +</li>
-Further down, add the tag+<li>Further down, add the tag
- <RDF:Seq RDF:about="chrome://mozapps/content/downloads/unknownContentType.xul">+<pre><RDF:Seq RDF:about="chrome://browser/content/browser.xul">
- <RDF:li>chrome://myextension/content/myOverlay.xul</RDF:li>+ <RDF:li>chrome://myextension/content/myOverlay.xul</RDF:li>
- </RDF:Seq>+</RDF:Seq></pre>
 +</li>
 +</ol>
 + 
 +It is usually quite easy to find the chrome URL of the window you want to overlay. For your convenience, the URLs of some windows are listed in [[Chrome URLs]]. If you don't see the window you need to overlay listed, get [[DOM Inspector]], open the window and click File > Inspect a Window > your window. The chrome URL will be displayed in the top textbox.
 + 
 +See also [[Dev : Extensions : contents.rdf]].
===Where Mozilla stores extension overlay information=== ===Where Mozilla stores extension overlay information===
When an extension is installed, overlay information found in its various contents.rdf files is copied into various overlays.rdf files located inside the [[Profile Folder]] under chrome/overlayinfo. For example, if a contents.rdf file contains When an extension is installed, overlay information found in its various contents.rdf files is copied into various overlays.rdf files located inside the [[Profile Folder]] under chrome/overlayinfo. For example, if a contents.rdf file contains
- <RDF:Seq RDF:about="chrome://mozapps/content/downloads/unknownContentType.xul">+<pre>
- <RDF:li>chrome://myextension/content/myOverlay.xul</RDF:li>+<RDF:Seq RDF:about="chrome://mozapps/content/downloads/unknownContentType.xul">
- </RDF:Seq>+ <RDF:li>chrome://myextension/content/myOverlay.xul</RDF:li>
 +</RDF:Seq>
 +</pre>
then this information is copied into <profile>/chrome/overlayinfo/mozapps/content/overlays.rdf. then this information is copied into <profile>/chrome/overlayinfo/mozapps/content/overlays.rdf.
Once an extension is installed, Mozilla pays no further heed to the contents.rdf files and refers instead to the overlays.rdf files. Once an extension is installed, Mozilla pays no further heed to the contents.rdf files and refers instead to the overlays.rdf files.
- 
{{msg:stub}} {{msg:stub}}

Revision as of 23:45, 22 November 2004

Much of the information intended for this page is not written yet. Take a look at http://xulplanet.com/tutorials/xulapp/overlays.html

Registering overlay information for extensions

Specifying overlays when developing extensions

Information about overlays should be specified in a contents.rdf file inside the same folder as your overlays. For example, if you have an overlay in content/myextension/myOverlay.xul in myextension.jar which overlays the chrome://browser/content/browser.xul location (<install directory>/chrome/browser.jar/browser/content/browser/browser.xul file), you should include the following two things in content/myextension/contents.rdf:

  1. Add the line
    <RDF:li RDF:resource="chrome://browser/content/browser.xul"/>

    inside the tag

    <RDF:Seq RDF:about="urn:mozilla:overlays">
    </RDF:Seq>

    (Create this tag if it doesn't already exist.)

  2. Further down, add the tag
    <RDF:Seq RDF:about="chrome://browser/content/browser.xul">
    	<RDF:li>chrome://myextension/content/myOverlay.xul</RDF:li>
    </RDF:Seq>

It is usually quite easy to find the chrome URL of the window you want to overlay. For your convenience, the URLs of some windows are listed in Chrome URLs. If you don't see the window you need to overlay listed, get DOM Inspector, open the window and click File > Inspect a Window > your window. The chrome URL will be displayed in the top textbox.

See also Dev : Extensions : contents.rdf.

Where Mozilla stores extension overlay information

When an extension is installed, overlay information found in its various contents.rdf files is copied into various overlays.rdf files located inside the Profile Folder under chrome/overlayinfo. For example, if a contents.rdf file contains

<RDF:Seq RDF:about="chrome://mozapps/content/downloads/unknownContentType.xul">
	<RDF:li>chrome://myextension/content/myOverlay.xul</RDF:li>
</RDF:Seq>

then this information is copied into <profile>/chrome/overlayinfo/mozapps/content/overlays.rdf.

Once an extension is installed, Mozilla pays no further heed to the contents.rdf files and refers instead to the overlays.rdf files.