|
|
(20 intermediate revisions by 8 users not shown) |
Line 1: |
Line 1: |
| [http://wiki.mozilla.org/Mobile Fennec] has support for extensions. Extensions are built using the [http://developer.mozilla.org/en/Building_an_Extension same methods] as any Mozilla-based extension. Since Fennec is a totally separate host application, there are some Fennec-specific issues that you need to handle when creating your extension. Most notably, the Fennec application ID and the differences in the user interface (UI) structure - the XUL used to build the UI. Extensions typically [http://developer.mozilla.org/en/XUL_Overlays overlay] the host application's UI to add toolbar buttons, menus and other features. Fennec is designed to work on devices with smaller screens and different usage models. For the most part, trying to use the same overlays in Firefox and Fennec is really not possible. | | Please see [https://developer.mozilla.org/en/Extensions/Firefox_on_Android the documentation on the Mozilla Developer Network]. |
| | |
| ==The Basics==
| |
| | |
| In order to install an extension in Fennec, you need to follow the guidelines for building a Mozilla-based extension. To support Fennec specifically, you'll need to add Fennec to the list of target applications in the extension's <code>[http://developer.mozilla.org/en/Install_Manifests install.rdf]</code> file. The code snippet will look something like this:
| |
| | |
| <pre>
| |
| <em:targetApplication>
| |
| <!–- Fennec -–>
| |
| <Description>
| |
| <em:id>{a23983c0-fd0e-11dc-95ff-0800200c9a66}</em:id>
| |
| <em:minVersion>0.8</em:minVersion>
| |
| <em:maxVersion>1.0.*</em:maxVersion>
| |
| </Description>
| |
| </em:targetApplication>
| |
| </pre>
| |
| | |
| In addition to the install manifest changes, you may want to expose your extension into the Fennec UI. Fennec does have a few familiar UI elements, such as a URL toolbar, a side toolbar with navigation controls and a browser content area. But Fennec doesn't have a main menu, statusbar, or even popup menus (yet). There are some new UI areas too: side toolbar holding the open tab thumbnails and a large offscreen panel for more complex UI features.
| |
| | |
| See the Fennec main window XUL file for the actual structure: [http://hg.mozilla.org/mobile-browser/file/8f96b58057ad/chrome/content/ browser.xul]
| |
| | |
| ==Porting an Existing Extension==
| |
| | |
| Since there aren't many extensions designed explicitly for Fennec, you may need to port your favorite extensions. This usually means extracting and editing the <code>install.rdf</code> file to add Fennec as a target application. You may also need to modify the extension's overlay to be able to work with the Fennec UI. Many archive tools, like 7zip, can edit and update a file in the archive without needing to manually extract it and add it back into the XPI.
| |
| | |
| There is also a collection of Fennec-specific [[Mobile/Fennec/CodeSnippets|code snippets]] that might be helpful.
| |
| | |
| ==Installing==
| |
| | |
| Extensions can be hosted on websites and installed by clicking on the extension link in Fennec. Make sure the webserver is serving the extension XPI with the right MIME type (application/x-xpinstall). The add-on installation UI should appear after clicking the link. Fennec supports a basic Add-on Manager user interface, which allows a user to manage extensions. Using this interface, a user can also install extensions from AMO (addons.mozila.org). Extensions can be removed using the same dialog.
| |