2

We have a intranet website to search customer details. This website is attempting to implement OpenSearch with the suggestions extension as documented at http://www.opensearch.org/Specifications/OpenSearch/Extensions/Suggestions/1.1#Declaring_a_JSON-formatted_search_suggestion_URL.

In /index.html:

<link rel="search" type="application/opensearchdescription+xml" title="XXX" href="/opensearch.xml" />

In /opensearch.xml:

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
  <ShortName>XXX</ShortName>
  <Description>XXX</Description>
  <InputEncoding>UTF-8</InputEncoding>
  <Image width="16" height="16" type="image/x-icon">
https://XXX/favicon.ico
  </Image>
  <Url rel="results" type="text/html" method="get" template="https://XXX/search.php?q={searchTerms}"/>
  <Url rel="suggestions" type="application/x-suggestions+json" method="get" template="https://XXX/opensearch-suggestions.php?q={searchTerms}"/>
</OpenSearchDescription>

Then opensearch-suggestions.php returns a static response:

["a@b.c",["a@b.c"],["XXX"],["XXX.php?email=a@b.c"]]

We can successfully get Safari to send the search to the desired page. However, while typing the suggestions are from DuckDuckGo and not our search engine.

Test case:

  1. Use macOS + Safari
  2. Command-N (new window, focuses URL bar)
  3. Type our intranet URL (the URL bar shows "Top Hit: (THE URL)")
  4. Press TAB (the URL bar changes to "Search (THE URL)")
  5. Type a search term like aaa

Expected result:

XXX is the autocomplete suggestion (see opensearch-suggestions.php above)

Actual result:

The URL bar shows "DuckDuckGo Suggestions" and some suggestions from DDG.


Have we implemented this incorrectly? Is there an incompatibility that will prevent us from implementing this standard?

William Entriken
  • 37,208
  • 23
  • 149
  • 195

1 Answers1

0

The reason why this didn't work was because Safari does not send cookies in the OpenSearch suggestions request.

This behavior is not defined in the OpenSearch specification and I don't see any documentation in Safari either.

William Entriken
  • 37,208
  • 23
  • 149
  • 195