User:Mconnor/Pending/SearchUpdates

From MozillaWiki
Jump to: navigation, search

Update URL

A new URL type to OpenSearch descriptors: application/x-opensearch-update

Example:

<Url type="application/x-opensearch-update"
     template="https://www.foo.com/searchupdater"/>

On first use of a search descriptor after the validity date, the UA will do a GET request to the URL specified. If there are no changes, return an HTTP 304 Not Modified response to the client. The UA should update the ValidUntil timestamp by either the UpdateInterval or the minimum next interval on this response. In order to minimize failed attempts, any errors will be treated as no update available.

If an update is available, the new search descriptor should be returned by the server and parsed by the UA. The new version will be used in place of the original version. If the base updateURL is different, the update MUST be rejected by the UA.

UAs providing a default set of descriptors may reset to a new default set and clear any updates as appropriate, and will check for updates for those defaults on first use as described above. This allows a change to updateURLs as needed.

UpdateInterval element

Optional: Contains an integer value corresponding to days between updates. If absent, the UA SHOULD check for updates on an interval no less than 7 and no more than 30 days.

Parent: OpenSearchDescription Restrictions: The value must contain 256 or fewer characters of plain text. The value must not contain HTML or other markup. Requirements: This element may appear zero or one time.

Example:

<UpdateInterval>7</UpdateInterval>

Forced Updates

If a UA navigates to a search descriptor served with application/opensearchdescription+xml on the same origin (host+scheme+port) as the updateURL, the UA will download and parse the descriptor file. If the Update URL is the same, the UA should update the local copy transparently.

Example Search Descriptor with Update support

<?xml version="1.0"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
    <ShortName>FooBar</ShortName>
    <Description>FooBar Search</Description>
    <Image height="16" width="16" type="image/x-icon">
      http://foo.com/favicon.ico
    </Image>
    <Url type="text/html"
         method="get"
         template="http://foo.com/search?search={searchTerms}" />
    <Url type="application/x-suggestions+json" 
         method="get" 
         template="http://foo.com/suggestions?search={searchTerms}"/>
    <Url type="application/x-opensearch-update"
         template="https://www.foo.com/searchupdater"/>
    <ValidUntil>1222311335</ValidUntil>
    <UpdateInterval>7</UpdateInterval>
</OpenSearchDescription>