Firefox/Projects/Firefox Start/Snippet Service: Difference between revisions

no edit summary
(Created page with "The about:home snippet service is a simple, highly-cached content management service. It is intended to assemble and deliver content snippets to the about:home page in Firefox. ...")
 
No edit summary
Line 8: Line 8:
browser.
browser.


== About about:home ==
== Overview ==
 
=== About about:home ===


about:home is a page built into Firefox 4 and above. By default, it
about:home is a page built into Firefox 4 and above. By default, it
Line 15: Line 17:
displayed from there until the next fetch.
displayed from there until the next fetch.


== Source code for service ==
=== Source code for service ===


If you'd like to contribute or want to run a development instance of the
If you'd like to contribute or just run an instance, get the source from here:
service, get the source from here:


* https://github.com/lmorchard/home-snippets-server
* https://github.com/lmorchard/home-snippets-server


== Using a non-production service with about:home ==
See {{bug|592431}} for historical context on this service.
 
=== Using a non-production service with about:home ===


For testing against staging (snippets.stage.mozilla.com) or a private
For testing against staging (snippets.stage.mozilla.com) or a private
Line 38: Line 41:
the localstorage variables used by the page. The add-on manages all of this.
the localstorage variables used by the page. The add-on manages all of this.


== Getting access to the production snippet service ==
=== Getting access to the production snippet service ===


This resource is highly protected, since it serves up content to all
This resource is highly protected, since it serves up content to all
Line 44: Line 47:
or ask someone who knows about the snippet service.
or ask someone who knows about the snippet service.


== Managing snippets ==
== Managing snippet service content ==


=== Client match rules ===
=== Client match rules ===
Line 76: Line 79:
HTML, CSS, and JavaScript. Snippets associated with client match rules matching
HTML, CSS, and JavaScript. Snippets associated with client match rules matching
the current request URL are included in the response.
the current request URL are included in the response.
For the sake of scaling, any images or other external resources should be
encoded as [http://en.wikipedia.org/wiki/Data_URI_scheme data: URIs] so that
everything required for the snippets is delivered in the same request.
All HTML content must also be well-formed XML.


Since multiple snippets can be included in the same response, the '''Sort order priority'''  
Since multiple snippets can be included in the same response, the '''Sort order priority'''  
Line 83: Line 92:
snippets, a value of -9999 will place it before the default of 0.
snippets, a value of -9999 will place it before the default of 0.


== Service response as a whole ===
=== Service response as a whole ===


The response from the service is the result of snippets associated with client
The response from the service is the result of snippets associated with client
Line 94: Line 103:
* include localized HTML content sandwiched between CSS and JS, using the sort order
* include localized HTML content sandwiched between CSS and JS, using the sort order
* serve up multiple blocks of HTML, all hidden by CSS and selectively revealed by JS at random
* serve up multiple blocks of HTML, all hidden by CSS and selectively revealed by JS at random
=== Example ===
Confirmed users
920

edits