Natali's Most Recent Work
Social Network with Natali
Follow Natali On Twitter
Speaking Requests
« CNET En Español | Main | A Makeover »
Thursday
Mar062008

UNData Firefox Plug-in

I wrote my first plug-in today for my Firefox search bar! This may be pretty remedial coding but I am feeling proud of myself nevertheless.

I wanted to have the ability to search terms directly on the new UN search engine, UNdata. I talked about this site on today’s episode of Loaded. After we filmed the show, I got to thinking that it would be really useful to have easy access to the site in my search bar so I decided to write a plug-in.

I realize I could have used the Add To Search Bar plug-in to make this job easier but I wanted to write the code myself for educational purposes. I also wanted to share it with the community so that I can say that I’ve written open source code because Wilson Tang told me that only one in 50 open source coders is a woman. That’s not enough!

I’ll admit, I didn’t do this on my own. I was able to make the plug-in by myself but I had trouble making it execute the search. Wilson and Randall Bennett from The 404 helped me out with that line of code. Thanks guys!

I am going to send this code to Mozilla so that they can share it but I also thought I would share it with you here. I hope it works!




<SearchPlugin xmlns="http://www.mozilla.org/2006/
browser/search/" xmlns:os="http://a9.com/-/spec/
opensearch/1.1/
">
<os:ShortName>UNData</os:ShortName>
<os:Description>UNData</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>

<os:Image width="16"
height="16">data:image/x-
icon;base64,
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAA
AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP38/
AH48vAV+fTyFP39/AH///8A9/HvGe3b1kjx5OAz////AP///wD///8A
////AP///wD///8A+fX0FOLGvGvSpZenw4d028GEceDRo5Wt5crCZOr
W0E327+0e////AP///wD///8A////AP///wD///8A////
AOrUzlfMmIi7yJOCx9y5rov06uco9u/sHP37+wP///8A////AP///
wD///8A////AP///wD///8A/fz8A+XLw2fEiXbZ37+0gcOJd9v16+gu
////AP///wD///8A////AP///wD///8A////AP///wD///8A////
APn08hjOn4+506iardatoKXWrqKh/f39Af///wD///8A////AP///wD///
8A////AP///wD///8A////AP37+wbTqZqr3LqvidKnmK7jxr14/
Pr6B96/tXHGkH7JyJOCwtSqnZn8+/sD5c3FV9Opm5v///
8A69nTQsiTgsL27+wk16+jm967sIfVq56j+vf2FP///
wC4c1z92LOniebQyFS4dF396tbQSN/AtnDFjnvN
+vf2DMmWhL+4c1z9+PLwHNCik7bLmIfF69bQVP///wD///
8AuHRd/e7e2Tr8+voGwYVx3eHFu2fgw7pqy5qJturW0Ei5dl/4uXVe
+uvWz1zWraCl4sS6eOfOx2L///8A////ALl1Xvrs2tU/
+vb1DsCEcN7ix75k4ca8ZcSLeNPDiXbV1a6gk7+CbePx498/z5
+Qu9myppv59PMV////AP///wC4c1z969jSRPr29Q6
+f2rp4MO6auLIv2K4c1z9voBr5/Ln4yq7emTw7NrVUNGklbPZtKiZ8uPfNf
///wD///8Ay5qJtvDj3zD7+PcK0KSVpenVzkrq19FGyJOCwuTLw1z7
+fgHzp6PrvHk4DLat6uTyJOBzeG/tnj///8A////AP///wD///8A
////AP///wD///8A////AP///wD///8A////AP///wD///
8A5czEYtOomqfQopSz6dXOV////wD///8A////AP///wD///
8A////AP///wD///8A////AP///wD///8A////
APfx7xnQopOu0aKTs86ejr3v4NtC////AP///wD///8A////AP///
wD///8A////AP///wD///8A////AP///wD///
8A+fTyFePHv3XTqJqzzJuLwfPo5Dj///8A////
AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///
wD///8A9OvoLvPo5DPo0sxc/fz7Bv///wD///8A////AP///
wD///8A////AP///wD///8A//8AAPh/AADx/wAA4/8AAMP/
AACONgAAjLQAAJ20AAC9sAAAnbIAAJ22AACf/
wAAz/8AAMf/AADz/wAA//8AAA==</os:Image>

<SearchForm>http://data.un.org/Default:Search.aspx<
/SearchForm>

<os:Url type="text/html" method="GET"
template="http://data.un.org/Search.aspx?q={searchTerms}
">

</os:Url>

</SearchPlugin>

Update: Oh right, what do you do with this code. Sorry! If you are using a Mac, save it as an XML file here:
Library>Application Support>Firefox>Profiles>searchplugins
Once you do that, you'll have to restart your browser and it should work.

If you're using a PC, I believe you add it to your Firefox folder in your applications. I haven't used a PC in a long time so I'm sorry if that is incomplete. Any PC users want to set me straight?

Reader Comments (8)

Very cool. What you haven't mentioned though - which some people might need, is how to install it. I ended up creating a small html file and letting Firefox auto-discover the plugin.

I'm intrigued about the image encoding. was it as simple as opening the image with a hex editor or something else?

March 6, 2008 | Unregistered CommenterKevin

You could add the following line to your blogs index page. Then any vistors to your blog could install in on the fly because the browser will "auto-discover" it. You'll will have to change the url a little

March 6, 2008 | Unregistered CommenterKevin

Congrats on writing your own code. That is so awesome that, I wish i had some coding skills. That is such a great use of your coding skills. Keep up the coding and the amazing work that you are doing on Loaded.

March 7, 2008 | Unregistered CommenterSam R

whoa. (channeling keanu).

time to spin the propeller on top of the hat... that's cool. Nice job.

March 7, 2008 | Unregistered Commentersunsnapper

Nice review

March 7, 2008 | Unregistered CommenterNessa

you should really update your myspace. i know you are busy and all but a tech geek that doesn't log onto myspace?

by the way you have to be the sexiest tech geek ever in the history of female tech geeks. just decided to drop that just in case you ever feel like you are too fat or not pretty enough as women tend to think.

March 9, 2008 | Unregistered Commenterupdate your myspace

I was telling Naldo that you can speak his language. He just rolled his eyes at me. Hard to believe that he and so many others work with code like that everyday. Amazing!

PS - I really like that tan jacket you wore on Thursday's show! Very chic!

March 10, 2008 | Unregistered CommenterBonbon

Hi, I have been trying to create an the html page to auto-discover this plugin. I haven't gotten it to work yet. Does anyone have an example html page they would post ?

thx

-mike

August 8, 2008 | Unregistered CommenterMike

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>