Jim's Blog Ramblings about novels, comics, programming, and other geek topics

1Aug/080

Creating an OpenSearch Provider

Google AdSense

4Guys From Rolla wrote a nice article titled "Helping Visitors Search Your Site By Creating an OpenSearch Provider". Scott Hanselman of Computer Zen also blogged about this a few days ago on his post named "Adding OpenSearch to your website and getting in the Browser's Search Box".

One of the nicest features of modern browsers like Mozilla Firefox and Microsoft Internet Explorer is the search bar in the upper right corner. With this tool you can quickly search any number of websites without having to first visit their search page.

-- Scott Mitchell, 4 Guys From Rolla .com

OpenSearch is an XML standard used for search providers. These search providers can be added to your browser's standard search engines by a single click (or two).

To let your users add your site's search engine to their browser bars, you just need to create an XML file and then reference it via a link element on your web pages. In less than 5 minutes, I was able to create the XML file, place it in my web app, add the <link> reference to my MasterPage, and deploy the application. Now, users can add the site's search provider (not this blog) to their browser.

The key is the URL XML element that includes the "{searchTerms}" variable. This variable will be replaced with whatever the user enters into the search box. Your search page will need to support URL parameters and parse out the searchTerms value.

James Welch

James Welch is a software engineer in Vermont working for a large information technology company and specializing in .NET. Additionally, he holds a Master’s Degree in Software Engineering and a Bachelor of Science Degree in Computer Science. Jim also enjoys local craft beer, comic books, and science-fiction and fantasy novels, games, and movies.

Twitter Google+ 

Comments (0) Trackbacks (0)

No comments yet.


Leave a Reply

No trackbacks yet.