22858 total geeks with 3297 solutions
Recent challengers:
best bread maker
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 

Articles

GEEK

User's box
Username:
Password:

Forgot password?
New account

Shoutbox
sefo
anilg, new comments are deleted automaticall y because of some abuse recently
anilg
this is plain wierd. I submitted comments twice to article 950, and they dont seem to be there. Something wrong with the comment code?
CodeX
shout-boxes in general are old + the staff thing happened to everyone after an issue 2 months ago
anilg
/me is no longer staff :(
anilg
Also, osix's shoutbox predated twitter. Heh.

Donate
Donate and help us fund new challenges
Donate!
Due Date: Jul 31
July Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00
Contributors


News Feeds
The Register
UK.gov sticks to IE
6 cos it"s more
"cost effective",
innit
T-Mobile UK pumps
out the iPhone 4
Polaroid 300
instant print
camera
NatWest dumps O2
Money
YouTube ups video
time limit
Alleged expenses
fiddlers to face
justice
Nude trampolinist
bounces free from
court
Nexus One phone
rockets to 28,000ft
UK.gov drops £6m on
Google
Fake Firefox update
used to sling
scareware
Slashdot
British ISPs Favour
Well-Connected
Customers
"Bizarre"
Nanobubbles Found
In Strained
Graphene
1-in-1,000 Chance
of Asteroid Impact
In
...
2182?
2 Chinese ISPs
Serve 20% of World
Broadband Users
World"s Fastest
Hybrid OK"d For
Production
Sometimes It"s OK
To Steal My Games
Thermoelectrics
Could Let You Feel
the Heat In Games
KDE SC 4.7 May Use
OpenGL 3 For
Compositing
Perl 6, Early, With
Rakudo Star
Internal Costs Per
Gigabyte —
What Do You Pay?
Article viewer

Writing your own Firefox Searchbar Entry



Written by:cyben
Published by:SAJChurchey
Published on:2004-08-23 23:46:09
Topic:General Internet Knowledge
Search OSI about General Internet Knowledge.More articles by cyben.
 viewed 6598 times send this article printer friendly

Digg this!
    Rate this article :
So, you want to add a new search engine, or dictionary, or whatever to your Firefox Searchbar, but to your absolute horror, you find it's not listed on mozdev.org! Erk! Then sit down, read this article, and write it yourself.

What is needed? Your basic search script needs to know what site to look at, what form to fill out, what picture to use, how often to update itself and where to update itself from. Of course, being the nice people that we are, we will satisfy all of the scripts desires; otherwise, it gets cranky, and we don't want that.

So, open up notepad. It is customary to begin your search script with a couple of lines of comments. For these, a comment is any line that begins with a #, so comment away your title, your name, your email adress, and any info that you think anyone who could concievably get their hands on this might want to know. If you're not going to share it, comment anyway. Just do it. I know, 'comments r teh sux!!1', but it's a good habit to get into.

Now, to begin the actual script. Put this in:

<search
   version = "..." //latest version that this has been tested with
   name="..." //whatever it's called
   description="..." //go on, you know you want to!
   method="..." //whatever the form uses (usually "GET")
   action="..." //check the source of the page for the form action
   searchform="..." //the page on which the search-form resides
>


Now, you've got to take a look at the page you're writing this for. What is the form asking? What are the different inputs? Are there some hidden ones? Those need to go in too, but don't forget to give the one you'll be filling in, the search box, its propper name:

<input name="..." user=""> //whatever the input name is for what you'll type
<input name="..." value="..."> //fill in the rest of the form, if needed


I'm not exactly sure why this is necessary, but you also need to supply some information about where on the page you'll go to, where the results are. So, find salient small snippets of the source-code of the resultant site to fill these in. You should tell it where the results start and end, and the items start and end. As an example, I have supplied those used by Google.

<interpret
    resultListStart="<!--a-->"
    resultListEnd="<!--z-->"
    resultItemStart="<!--m-->"
    resultItemEnd="<!--n-->"
>


OK, that's the end of the searching part. Next, let's add a pretty tag on the next line:

</search>


Right. We're almost done. There's just one thing left to do. Perhaps sometime, you'll need to update this script: perhaps the forms on the site will change, perhaps you just noticed a bug. Whatever the reason, you don't want to have to email all your friends and say "hey guys, you gotta download the search thing again. Sorry", do you? And besides, you also want to make a pretty picture. So, one last part:

<browser
   update="http://website.domain/dir/script.src" //full url of where you'll upload this and updates
   updateIcon="http://website.domain/dir/pic.png" //full url of the pretty little pic you'll make
   updateCheckDays="..." //3, or 7, or whatever you want
>


Done! Save that with the extension ".src". Now all we've got to do is make the picture. Try and make it descriptive, but keep in mind that it should be no more than a 16 by 16 pixel PNG. No less either. So make yourself a 16 by 16 pixel PNG, save it, and we're finished.

Now, for the last part: Installing it. There are two ways. First, you can make yourself a webpage with the handy javascript ripped straight from mozdev.org. That way looks cooler. Or, just copy the files into C:Program FilesMozilla Firefoxsearchplugins, or wherever it happens to be on your computer, and restart your browser.

Yay! You're done!

-Cyb.

Note: // in the code signifies my comments for this article. Do not comment lines in that manner within your script!

Did you like this article? There are hundreds more.

Comments:
Obscurity
2004-08-23 23:59:23
Pretty cool article, though I don't use Firefox it's interesting none the less.
oscinis
2004-08-24 03:34:37
was wondering just the other day how to go about doing this :) thanks, cy.
cyben
2004-08-24 11:17:56
Obscurity: what browser d'you use? Negligence of Firefox is one of the eight deadly sins...
Obscurity
2004-08-27 09:11:42
I use IE because Firefox takes too long to load on my box.
bb
2004-08-27 13:16:13
ive just about entirely moved over to firefox now (need IE for some stupid work reasons) mostly because of the articles cyben wrote here!
cyben
2004-08-27 13:38:41
Yay!I've made a difference!
Obscurity: the only reason IE is so fast is because windows preloads it (and just doesn't display it). You can preload firefox too!
Obscurity
2004-08-27 20:45:25
IE is all kernel hooked, I don't think FF is :)
optikal
2004-08-28 17:53:29
i dont think IE has anything to do with the kernel... and if you deleted explorer.exe as i did... no reason for IE :-)
zethyr
2004-12-23 23:39:19
You shouldnt delete IE if you are planning to use other MS-apps, because they all are built into the kernel.
Many people actually thinks this makes IE faster, but it doesnt. The fact is that all the modules IE have to load also contains data for other applications, so it actuallt is slower than a 3rd part browser ;)

I'd definitely take look at FF, or maybe Opera.
http://www.opera.com <-- small install file, LOTS of functions already built in. I dont use it because I find it hard to navigate in that browser, tho...
voodoomagic
2005-02-08 22:34:06
u deleted explorer.exe? that would make your computer not work, since explorer.exe is the program used to display the desktop and everything. to delete ie u want to trash iexplore, but thats not even a proper way to get rid of it, and u shouldnt delete it anyway, because like zethyr said u need it for other ms apps, and for windows update, so deleting it would just close a gateway for becoming secure, which would pretty well not out the whole purpose of getting firefox.
Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)
BB Code is enabled.
Captcha Number:


Blogs: (People who have posted blogs on this subject..)
sydnie121
Blog entry for Mon 15th Oct 6pm on Mon 15th Oct 6pm
The internet at my school sucks ass everything is blocked
bb
Concert Ticket Generator on Wed 2nd Aug 8am
Someone showed me this hilarious site today for generating your own concert tickets. Concert Ticket Generator Make your own virtual concert ticket Now you never have to admit you missed the show. Just enter some text and click the 'Go' button.


     
Your Ad Here
 
Copyright Open Source Institute, 2006