Home Page Snippets for Firefox for Android
Have you ever noticed the messages that appear under the search box on desktop Firefox’s home page? We call these messages snippets, and they’re dynamically created from web content hosted by Mozilla. These snippets provide an easy way to communicate with desktop users, but right now there’s no equivalent feature for Firefox for Android.
Since we first released the native version of Firefox for Android, we’ve included a hard-coded promotional banner as part of our home page – you’re probably seen it encourage you to set up Firefox Sync. However, we’ve been working on a complete rewrite of the home page for Firefox 26 (exciting!), and we’re taking the opportunity to replace this with a new customizable banner.
Because this banner is part of our native Java UI, we can’t just load web content the way desktop does. Instead, we decided to build a JS API to let add-ons customize it. We came up with a simple API that lets developers add and remove items from a set of messages that rotates through this banner. Right now, these messages just consist of an icon, some text, and a click handler. We put this banner API in a new Home.jsm module, since we have plans to add more home page customization APIs to this module in the future!
As a demo, I made an add-on that fetches data from a basic snippets server, and turns that data into messages that are added to the home banner. This server currently serves data from the 5 most recent @FennecNightly tweets, which is actually pretty relevant to Nightly users. If you’re using Nightly, I’d encourage you to try it out, and as always, please file any bugs you find!