OpenSearch and Chrome Document Discovery

I'm trying to figure out how to advertise a web application search endpoint with OpenSearch (see http://www.opensearch.org/Specifications/OpenSearch/1.1#OpenSearch_description_document ), but even my simplest example does not work. I have index.html with:

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> <head profile="http://a9.com/-/spec/opensearch/1.1/"> <link title="Search" rel="search" type="application/opensearchdescription+xml" href="osdd.xml"/> </head> <body> hello </body> </html> 

And osdd.xml containing:

 <?xml version="1.0" encoding="UTF-8"?> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/"> <ShortName>test</ShortName> <Description>test</Description> <Url type="text/html" template="http://example.com?q={searchTerms}"/> </OpenSearchDescription> 

But nothing works. Chrome's "tab to search" behavior doesn't show up, and with the Chrome developer tools, it doesn't seem to load osdd.xml at all.

Any clues?

+4
source share
2 answers

Downloading the osdd.xml file does not appear on the Developer Tools> Network tab.

http://code.google.com/p/chromium/issues/detail?id=58801#c3 (comment 3) mentions that you need to search at least once to add a search engine.

I also found that you need to remove existing search engines from Settings> Manage Search Engines and restart the browser to see the effects of the changes in the osdd file.

+4
source

Sorry to have dug this topic, but I had a similar problem and I managed to solve it, so I leave my results here if anyone finds it.

In my case, the XML file was not on UTF-8, so Chrome was not loaded correctly. Make sure your file is on UTF-8.

Hooray!

+2
source

Source: https://habr.com/ru/post/1388216/


All Articles