Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I use Google Chrome. When I want to search Wikipedia, I type www.wikipedia.org into the search bar and then press tab. The screen looks like this:

enter image description here

If I type some search words, it uses the actual search functionality of Wikipedia, instead of just returning a Google search of site:www.wikipedia.org x y z.

I have a site with search functionality using a regular html form, but I can't do the tab trick to search the site. Is there any way I can change my site's search page to be recognized by Chrome (and possibly other applications, if there's a standard format)? Google searching this only gives me results about registering my site with the Google search engine, frustratingly.

share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

Ironically the answer is on this page and every other Stack Exchange site :)

You have to define an OpenSearchDescription for your site. If you look at the source code of this page you will see in the header:

<link rel="search" type="application/opensearchdescription+xml" title="Pro Webmasters - Stack Exchange" href="/opensearch.xml">

And if you open opensearch.xml referenced here you see:

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Webmasters</ShortName>
<Description>Search Webmasters: Q&A for pro webmasters</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">http://sstatic.net/webmasters/img/favicon.ico</Image>
<Url type="text/html" method="get" template="http://webmasters.stackexchange.com/search?q={searchTerms}"/>
</OpenSearchDescription>

You have to implement the same for your site. The key is that you do need some kind of search implemented on you site which is used by the broswer to perform the actual search. This is specified in the template part of the XML:

http://webmasters.stackexchange.com/search?q={searchTerms}

Google Custom Search can be used for this purpose if you have no current search on your site.

share|improve this answer
    
Wikipedia.org doesn't seem to have that. Is Wikipedia just special or did I miss it? –  Nate Glenn Mar 4 '13 at 21:54
    
@NateGlenn See en.wikipedia.org - Line 12 of the source-code :) Notice they use a PHP to generate the description. –  Itai Mar 4 '13 at 21:57
    
I see now! What about metacpan.org? They have the OpenSearch thing, but Chrome doesn't recognize it and give me the tab shortcut, even after visiting it a bajillion times. –  Nate Glenn Mar 4 '13 at 22:03
    
@NateGlenn Well. If Chrome does not recognize it, they may simply have a typo or error in it. I cannot diagnose it but I can tell you that the above procedure works for my own sites :) –  Itai Mar 4 '13 at 22:05
    
Thanks! I'll use this method. –  Nate Glenn Mar 4 '13 at 22:09
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.