[Looking for Charlie's main web site?]

Add searching for CF blogs, docs, etc. to your FireFox Search bar list of search engines

Note: This blog post is from 2008. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Someone who had learned of my CFSearch search engine (which searches over 1300 CF blogs, docs/article sites, and more) wondered if they could arrange to have it appear in the Firefox Search Bar in the top right of the browser. The answer is yes, via a simple Firefox add-on (which you can use to add any search site to the search bar).

This is a cool thing, because while you can choose from several pre-defined search sites (google, yahoo, amazon, ebay, and more), and you can click a "manage search engines" option to go to a Firefox site to find still more, you can only pick those that are listed on the Firefox site.

As with this gent, some search engines will just never be popular enough to be listed there. So how to add them?

Get the "Add to Search Bar" Add-on

The good news is that there is a FF add-on that does just what he wants, Add to Search Bar. It's simple and very effective (see the comments at the Mozilla page link, where many ask--rightfully so--why it's not built into FF.)

You can also learn more about it in someone else's blog entry highlighting it.

How about accessing a site's search feature using a single keyword in the address bar

FWIW, I'll also note that rather than use the FF toolbar, one can also set things up so that a given page's search feature can be accessed from a single address bar keyword (if they don't have or don't want to alter that search bar in the top right). I blogged about that in my TipicalCharlie site, where I sometimes blog things that aren't of a CF nature but might appeal to just anyone. (Update: tipicalcharlie domain is no more, but page recovered using Archive.org.)

One more time about CSEs

Finally, just as a reminder, the CFSearch site I created is what's called a Google "custom search engine". I wrote previously about them and how other people had also come up with their own variants. You may want to check them out, too.

For more content like this from Charlie Arehart: Need more help with problems?
  • If you may prefer direct help, rather than digging around here/elsewhere or via comments, he can help via his online consulting services
  • See that page for more on how he can help a) over the web, safely and securely, b) usually very quickly, c) teaching you along the way, and d) with satisfaction guaranteed
Comments
Actually, you don't need an addon to do this, though it's certainly handy.

http://markpasc.org/...

I did one a few years ago that searches the employee directory on our intranet. Pretty handy.
# Posted By JC | 8/1/08 3:26 PM
JC,what is that that you've offered? It's some HTML-looking tags, though with the reference to a search tag, I guess it's meant to use with something. Is it to modify some file in FF? We need more info.

Now, before you do offer that, are you sure this is doing what this entry is about: adding a new search engine to the firefox search bar?
Whoops, I thought that link had the full thing.

The .src file is how Firefox stores searches. You modify one and store it on your site with a .gif for an icon, and call it with a javascript link. Here's mine (and the code looks weird, but it works).

[search
name="mySearch"
description="Employee Directory Search"
action="http://your.domain.c...dosearch.cfm" target="_blank">http://your.domain.c..."
searchForm="http://your.domain.c...dosearch.cfm" target="_blank">http://your.domain.c..."
method="GET"]
[input name="MySearch" user=""]
update="mySearch.src"
updateIcon="mySearch.gif"
updateCheckDays="7"
[/search]

---

[script type="text/javascript"]
function errorMsg()
{
alert("Mozilla Firefox is required in order to install this search plugin.");
}

function addEngine(name,ext,cat)
{
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function"))
{
//cat="Web";
//cat=prompt('In what category should this engine be installed?','Web')
window.sidebar.addSearchEngine("http://your.domain.c..."+name+".src","http://your.domain.c..."+name+"."+ext,name,cat);
}
else
{
errorMsg();
}
}[/script]
[a href="javascript:addEngine('mySearch', 'gif', 'Web')"]Click to Add MyDomain Search Plugin[/a]

For someone who's running a resource that people may want to add a search box for, it would seem to be a lot more convenient than having to explain downloading and installing an addon and so on. (but it's a great addon, people should get it anyway)
# Posted By JC | 8/1/08 4:50 PM
Meh. I guess that approach may appeal to some. You say this is all "a lot more convenient than having to explain downloading and installing an addon and so on". I don't see it.

I mean, I don't mind bit twiddling when it comes to digging into CF stuff, but in this case the add-on seems just so much more straightforward. :-)
Why doesn't anyone ask me? ;-)

Don't use EITHER format above. Use the Open Search format then other browsers can add it too. It is the recommended Firefox format now (if all this doesn't appear right below, you can always google):

<?xml version="1.0"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec...">
<ShortName>CFSearch</ShortName>
<Description>whatever</Description>
<Image height="16" width="16" type="image/x-icon">http://mysite.com/fa...</Image>
<Url type="text/html" method="get" template="http://mysite.com/re...
</OpenSearchDescription>

<script language="JavaScript">function addOpenSearch(engine){if(window.external&&("AddSearchProvider" in window.external)){window.external.AddSearchProvider("http://mysite.com/se...");}else{alert("Your browser is too old, sorry! You should download a new one. We recommend Firefox.");}}</script>

You can use png and whatever for the image too.
# Posted By ziggy | 8/1/08 10:52 PM
>>function addOpenSearch(engine)

I have a bunch of them for searching in different currencies on our site, hence the variable which I forgot to edit out. Remove if only one engine. Otherwise do something like:

window.external.AddSearchProvider("http://mysite.com/se..."+engine+".xml")
# Posted By ziggy | 8/1/08 10:57 PM
Oops, one last thing: if you want the browser to signal users about the engine (Firefox goes blue around the search icons), add this:

<link rel="search" type="application/opensearchdescription+xml" title="CFSearch" href="http://mysite.com/se...">

Then people just add via the browser, no js needed.

Well, that only took 3 posts...
# Posted By ziggy | 8/1/08 11:02 PM
Ziggy, as with JC's suggestion, I'll say 2 things: where would one put this code? And also, it just sure seems a lot more work for most people's needs. Cool if it works for you, and that it benefits those using other than just Firefox, and it may well be the "right" thing to do down the road. Hey, I still build tabular content in HTML using Tables. Call me a luddite. :-) But as with his notes, I'll say for others who appreciate it, thanks.

Finally, I'll say that it's interesting that you guys have jumped on this. I don't usually get many comments (especially from you guys), so it's curious that this one has been so compelling for you both. :-)

Let's just say that if anyone else has more ideas for other ways to do this, I think we have enough. :-) The point was how to add the CSE to the search bar. We now have three ways, and that's plenty.
I think you're missing the point, Charlie. The instructions above have nothing to do with the end user.

*You* put this stuff on *your* site so it's convenient for the user. They just click a link on your page, hit OK on the "would you like to add this search" prompt, and then they can search your directory from firefox without any addons. I'm pretty sure clicking a link *is* less complicated than downloading an addon and then going through the process of adding your site through it.

and by all means, if Ziggy's code is the recommended way to do it now, cool... I just dug that snippet off my intranet where I last dumped it 3 or 4 years ago. It does still work, though. :)
# Posted By JC | 8/2/08 1:43 AM
Ah, ok, right. Sorry, I was totally missing that point. Thanks for the clarification. I may consider that. Someone had asked me how they might add my CFSEARCH to their Firefox search bar, and I found that solution and offered it. Since I was also posing it as something others could use to add any search engine to their search bar, I just wasn't thinking in the context of something I could/would offer on my site to do it for them. I can see value in it, though, so again, thanks for sticking with me to explain things.

I'll add that if anyone wants to learn more about this approach, as well as the Open Search format Ziggy was referring to, here are several blog entries that discuss implementing the techniques these guys were referring to:

http://forums.blogze...,9.0.html
http://orand.blogspo...
http://www.captain.a...
http://cdeweese.blog...
http://about.scribli...
http://weblog.infowo...

If I may say so, I'd suggest that if anyone ever drops code like the above on another blog entry offering this solution, it would really help to make this point about it being to either do on one's own machine or to post for others to download and implement on theirs. Pointing to one of these to blog entries would also help, I think. Again, thanks.
>>how they might add my CFSEARCH to their Firefox search bar, and I found that solution and offered it

An addon isn't really the solution for a specific engine, the way above is. AND it works in IE7!

But that is a neat addon for sites not offering engines, thanks. I think it was taken from Opera where it is built-in.

Again, you don't need any javascript at all; it works if you just add the one line header link. For example, see the blue indicator on the search icon come up when going here http://www.onelook.c... ? Then you get an option to add it in the dropdown. Probably people aren't all aware of that so a sidebar box with the info and js is good.

@jc I had the same code as you from years ago then heard about OpenSearch when I had to redo some stuff.
# Posted By ziggy | 8/2/08 10:50 PM
Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting