Making usage of Google Chrome's OmniBox [TAB] Feature for/on personal website?
Asked Answered
L

2

15

I think the title explains it all but I am going deeper into my question anyway:

How can I make use of the Chrome's Omnibox [TAB] feature for my website?

As many users requested me to implement that feature on the site, I did research on the OpenSearchDescription and was very successful in implementation with the FireFox and IE7/IE8 Searchbar.

Yet the implementation didn't quite work for the Chrome Omnibox [TAB] feature..

Can you help me with that?

My OSD.xml code:

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                       xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>MySite</ShortName>
<Description>My Site</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">http://MySite.com/favicon.ico</Image>
<Url type="application/x-suggestions+json" method="GET"
     template="http://ff.search.yahoo.com/gossip?output=fxjson&amp;command={searchTerms}" />
<Url type="text/html" method="POST" template="http://MySite.com/query.php">
  <Param name="sString" value="{searchTerms}"/>
</Url>
<Url type="application/x-suggestions+json" template="suggestionURL"/>
<moz:SearchForm>http://www.MySite.com</moz:SearchForm>
</OpenSearchDescription>

And this is the link to the osd file on my page:

<link rel="search" type="application/opensearchdescription+xml" title="MySite" href="/opensearch.xml" />
Lissotrichous answered 22/8, 2009 at 21:7 Comment(2)
Never knew we could do this, thanks for accidentally letting me know.Shrink
possible duplicate of How to add google chrome omnibox-search support for your site?Ileac
L
4

Getting OSD (OpenSearchDescription) work under Google Chrome or IE7 / IE8 isn't as difficult as mentioned or that these browsers don't support POST requests.

With a little bit of tweaking, I found a workaround to the entire problem.

My initial code:

<Url type="text/html" method="POST" template="http://MySite.com/query.php">
  <Param name="sString" value="{searchTerms}"/>
</Url>

This code points directly to the query page and passes the value for the sString attribute on my POST request.

That works perfectly on FireFox but doesn't quite work well on IE7/IE8 or Google Chrome (I didn't test with Opera or Safari yet..).


Altering the code to the following piece:

<Url type="text/html" template="http://MySite.com/query.php?sString={searchTerms}"></Url>
  • Removing method="POST" from the element
  • Replacing /query.php with the actual page call: /query.php?sString={searchTerms}
  • Removing the now unnecessary "<Param name="sString" value="{searchTerms}"/>"

Resolved my problem of incompatibility with those browsers.

All calls are directly headed to the query page and even it initially was a POST request, it now work on both IE7/IE8 and Google Chrome.

Thanks again adrianbanks for providing me with your xml file which led to the solution!

Lissotrichous answered 23/8, 2009 at 1:26 Comment(1)
-1 You start your answer with "Getting OpenSearchDescription work under Google Chrome or IE7 / IE8 isn't as difficult as mentioned or that these browsers don't support POST requests" and then you proceed to describe in a very verbose way that those browsers indeed don't support search by POST request".Seeto
C
8

I've compared what you have against the OpenSearchDescription on my own site and I cannot see why yours is not working. The only real difference is that you are using POST to search whereas I am using GET. According to this page, IE7 does not support POST requests, so it may be that other browsers also do not support POST.

The one on my site definitely works in IE8, Chrome 3.0 and FF 2.0+. Feel free to compare them yourself and see if you can spot a difference: opensearch.XML

Cellaret answered 22/8, 2009 at 23:17 Comment(1)
Thanks a lot for your great help and providing your own osd file! It led to the solution. I will be writing an answer that solves the issue also allows use of POST in IE and Chrome :-)!Lissotrichous
L
4

Getting OSD (OpenSearchDescription) work under Google Chrome or IE7 / IE8 isn't as difficult as mentioned or that these browsers don't support POST requests.

With a little bit of tweaking, I found a workaround to the entire problem.

My initial code:

<Url type="text/html" method="POST" template="http://MySite.com/query.php">
  <Param name="sString" value="{searchTerms}"/>
</Url>

This code points directly to the query page and passes the value for the sString attribute on my POST request.

That works perfectly on FireFox but doesn't quite work well on IE7/IE8 or Google Chrome (I didn't test with Opera or Safari yet..).


Altering the code to the following piece:

<Url type="text/html" template="http://MySite.com/query.php?sString={searchTerms}"></Url>
  • Removing method="POST" from the element
  • Replacing /query.php with the actual page call: /query.php?sString={searchTerms}
  • Removing the now unnecessary "<Param name="sString" value="{searchTerms}"/>"

Resolved my problem of incompatibility with those browsers.

All calls are directly headed to the query page and even it initially was a POST request, it now work on both IE7/IE8 and Google Chrome.

Thanks again adrianbanks for providing me with your xml file which led to the solution!

Lissotrichous answered 23/8, 2009 at 1:26 Comment(1)
-1 You start your answer with "Getting OpenSearchDescription work under Google Chrome or IE7 / IE8 isn't as difficult as mentioned or that these browsers don't support POST requests" and then you proceed to describe in a very verbose way that those browsers indeed don't support search by POST request".Seeto

© 2022 - 2024 — McMap. All rights reserved.