Friday, February 17, 2006

FogBugz browser search integration

FogBugz 4.0 has a handy new search URL that lets you enter a bug number to go directly to a bug, or search text to find all open cases matching your query. Wouldn't it be nice to hook this into your browser's search box? Fortunately, IE7 uses A9's OpenSearch for its search providers, and Firefox uses Mycroft.

Creating the OpenSearch provider

Create an XML file with the following text:

<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="">

<Description>Search FogBugz</Description>
<Url type="text/html" template="http://[your-ip-goes-here]/fogbugz/default.asp?pre=preMultiSearch&amp;pg=pgList&amp;pgBack=pgSearch&amp;search=2&amp;searchFor={searchTerms}" />

Replace [your-ip-goes-here] with the appropriate address.

Put the XML file on your web server and put the following link somewhere that's publicly accessible:

<a href="#" onClick="window.external.AddSearchProvider(&quot;http://[url-to-your-directory]/FogBugzOpenSearch.xml&quot;);">Add FogBugz search provider to IE7</a>

Replace [url-to-your-directory] with the appropriate URL.

Now, when you click on the link from IE7, you'll be prompted to add a new search provider. This will make a FogBugz option available in the dropdown list of your search box:

Creating the Firefox provider

Create a file named FogBugzSearch.src in a public directory on your web server with the following text:

description="Search FogBugz"
action="http://[your-ip-goes-here]/fogbugz/default.asp" searchForm="http://[your-ip-goes-here]/fogbugz/" method="GET"
<input name="pre=preMultiSearch&amp;pg=pgList&pgBack=pgSearch&search=2&searchFor" user=""> </search>




Fill in the blanks with the appropriate addresses and URLs.

Put the following image in the same directory:

Now to create the link. Put the following in your head element:

<script type="text/javascript">
function addEngine(name,ext,cat,type)
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {

"http://[url-to-your-directory]"+name+"."+ext, name, cat );


and the following link in your page:

<a href="javascript:addEngine('FogBugzSearch','png','General','0')">Add FogBugz search provider to Firefox</a>

Now, when you click on the link from Firefox, you'll be prompted to add a new search provider. This will make a FogBugz option available in the dropdown list of your search box:

1 comment:

Michael Fagan said...

Nice feature that FB enables.

There is a Firefox-to-OpenSearch converter here: which may have saved you several seconds :-)

Also, while you can use the javascript function in IE7, you should also make use of autodiscovery .

I've written a single Javascript function to amalgamate the two functions you're using: .

And it looks like Firefox 2.0 will probably support OpenSearch, so we won't have to do all this anyway ;-)