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?
- Signup to get his blog posts by email:
- Follow his blog RSS feed
- View the rest of his blog posts
- View his blog posts on the Adobe CF portal
- 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
http://markpasc.org/...
I did one a few years ago that searches the employee directory on our intranet. Pretty handy.
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?
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)
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. :-)
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.
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")
<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...
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.
*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. :)
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.
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.