Scott Donnelly

OpenSearch - A quick tip

I’ve learnt some great new skills today involving OpenSearch, and browser search plug-ins. Not enough time to put it all into an article right now, but I will work on one over the next few days.

In the meantime, a quick tip - something that may save someone a bit of time.

When linking to an OpenSearch description document to enable auto-discovery, an HTML link tag to the XML OSDD is used. The type property is set to “application/opensearchdescription+xml”, as per the OpenSearch spec. By default, however, as the OSDD file generally has a .xml suffix, Apache will serve the image up as text/xml. This can cause the browser to not accept the OSDD. The solution, if you are using .htaccess files, is a simple addition to the .htaccess file. Replace opensearch.xml with the name of your OSDD file:

<Files opensearch.xml>
    ForceType application/opensearchdescription+xml

Simple, I know, but it may cause a bit of head-scratching. More to come.