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

Jump to navigation Jump to search
Line 50: Line 50:


== Managing snippet service content ==
== Managing snippet service content ==
=== Snippets ===
A snippet is an arbitrary block of content - which includes any combination of
HTML, CSS, and JavaScript. Snippets associated with client match rules matching
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'''
field is used to provide a sort index. So, for example, if you have
some JavaScript to include after all snippets, a value of 9999 will place it
after than the default of 0. If you have CSS to place before any other
snippets, a value of -9999 will place it before the default of 0.
==== Considerations for external media used in snippets ====
Any HTML, CSS, or JavaScript can be used in snippets. However, any references to external media, such as images, should be encoded as data: URIs so that the snippets can be self-contained.
For example, a tool like [http://software.hixie.ch/utilities/cgi/data/data The data: URI kitchen] can be used to convert an image file into a data: URI.
If an external media resource is necessary, such as a video, it will need to be hosted somewhere that can handle the potential traffic of every Firefox user requesting the URL. This means using a CDN or other high-capacity web host.


=== Client match rules ===
=== Client match rules ===
Line 75: Line 101:
the snippet is excluded from the response, regardless of any other rules
the snippet is excluded from the response, regardless of any other rules
matching.
matching.
=== Snippets ===
A snippet is an arbitrary block of content - which includes any combination of
HTML, CSS, and JavaScript. Snippets associated with client match rules matching
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'''
field is used to provide a sort index. So, for example, if you have
some JavaScript to include after all snippets, a value of 9999 will place it
after than the default of 0. If you have CSS to place before any other
snippets, a value of -9999 will place it before the default of 0.


=== Service response as a whole ===
=== Service response as a whole ===
Confirmed users
920

edits

Navigation menu