OpenSearch-enabling your blog
Have you noticed when you visit some sites, there's a bluish glow in the search engine field in Firefox. Like this:

What does that even mean? Well, it means you can add this site's search to the drop down list of search engines. This functionality is following the open search standard.
The things are actually pretty simple. You need to have an XML file <link>-ed to from your page.
For example on this blog I have this in the head:
<link rel="search" type="application/opensearchdescription+xml" href="http://www.phpied.com/wp-content/plugins/open-search/open-search-xml.php" title="phpied.com : Search in posts" />
So how do you add open search capability to your blog? With the OpenSearch plugin for WordPress, naturally.
BTW, if you're running PHP4 you might get errors during installation, in this case just open up the open-search-class.php and
- replace all "public static" with empty string
- replace all "private static" with empty string
- replace all "self::" with "OpenSearch::"
This is it, enjoy and if you want to change the default icon, you need to look into replacing the image found in /wp-content/plugins/open-search/default-favicon.png
Here's what you get at the end:

And now your readers can add your search to their browser and quickly find content on your blog. Sweet.
This entry was posted on Friday, January 30th, 2009 and is filed under WordPress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Get notification for future posts: follow me on Twitter or subscribe to my RSS feed

January 30th, 2009 at 5:35 am
Nice one. I’ve just sent this to Word-reference.com so I can translate words by righ-clicking them. I’ve set this up myself on my home PC but can’t be bothered doing it on every PC I use.
January 30th, 2009 at 8:34 am
Niice, thanks Stoyan …
How do people see these things … that tiny glowing blue dot on gray background yak!
January 30th, 2009 at 4:13 pm
yep, Sorin, very subtle
On red hat looks more visible:

February 5th, 2009 at 10:19 am
hey stoyan
another way to do the image is to include it in the xml itself as a base64 encoded png
I at least prefer that way in sites I’ve worked on after I’ve optimized the png
February 5th, 2009 at 12:11 pm
Thanks lolol, that’s what this plugin seems to do.
Good point about optimizing the png
February 6th, 2009 at 12:19 pm
ah how foolish of me to not actually look through the code
maybe I am breaking some sort of standards by not using os: tags like you
Also will wordpress always make such a ridiculously long description line?
optimization seems to usually matter more for things that get encoded to base64, as in your image’s case 342bytes for image = 484bytes of base64, while optimized only a 66 byte diff of 276bytes for the optimized image is a difference of 116 bytes for the encoded file compared to the original
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAA20lEQVR4XmXN3ypFQRSA8cVzUN5hnZ7KioP4EYipdIJnahDhAokuSU6J5v9d8xsn9VUk5m9vsv1mzWisySZ5Ekrsihhsq6wvSNEx9rqf5LbvqL2ffHJO4431gNZkNzRYmi1koIPHA0VG0oCMEwYs88uW2yGryTXrQdYnGbpDczPniNgeOME445YJ89dthmngItXGko+U7BNRdMOWXCEYeMaWIQ3zBal4IHbrnhikvOtekA+Kz2E0rAC8888cg9dz4bgV8lw3oFfkamdv1wbUrJxM+yjNQOy3QjfgORR5brtfZAAAAAElFTkSuQmCC
February 10th, 2009 at 2:37 am
I am sorry if I post this comment at the wrong place , but I can’t found any other ways to contact YOU.
When I was reading the book “Object-Oriented Javascript”, at page 103 ,Chapter 4 , I doubt the correctness of your examples.
You said :
>>> function Hero(){}
>>> var h = new Hero();
>>> var o = {};
>>> h instanceof Hero;
true
>>> h instanceof Object;
false
>>> o instanceof Object;
true
How can “h instanceof Object” be false ? I guess you want to say o instanceof Hero be false , am I right ?
Notify me through email ,please .
February 10th, 2009 at 1:32 pm
Yes, Zel, you’re absolutely right.
instanceoffollows the inheritance chain soh instanceof Objectis indeedtrueAlso
>>> Object.prototype.isPrototypeOf(Hero)true
February 16th, 2009 at 2:42 am
thanks , another question .
I doubt the example from your explanation of “Lazy defination”.
At page 273 ,chapter 8 .
Your code like this :
*****************************
var MYAPP = {};
MYAPP.myevent = {
addListener: function(el, type, fn){
if (typeof el.addEventListener === ‘function’) {
MYAPP.myevent.addListener = function(el, type, fn) {
el.addEventListener(type, fn, false);
};
} else if (typeof el.attachEvent === ‘function’){
MYAPP.myevent.addListener = function(el, type, fn) {
el.attachEvent(‘on’ + type, fn);
};
} else {
MYAPP.myevent.addListener = function(el, type, fn) {
el['on' + type] = fn;
};
}
MYAPP.myevent.addListener(el, type, fn);
}
};
************************************
This code should be runnable , but does addListener() only be defined once like this ?
There is no return statement in your code , how can the subsequent calls of addListener() avoid running the branching?
Notify through email please . Thanks
February 16th, 2009 at 3:08 am
hey Zel,
Thanks for the question
MYAPP is a global variable, when you modify
MYAPP.myevent.addListenereven from inside a function, you’re still modifying the property of a global object.
same if you go something like:
GLOBAL = 1;function a() {
GLOBAL = 2;
}
a();
alert(GLOBAL); // 2
In the example you quote, the branching happens only once and during that first call the function overwrites itself. So the second time you use it, it has a new body which doesn’t have branching code in it.
You can easily test though. Just add a
console.logcall, like:... MYAPP.myevent = { addListener: function(el, type, fn){ console.log('called'); if (typeof el.addEventListener === 'function') { //....then use the function like
MYAPP.myevent.addListener(window, 'click', function(){alert('click')});(this will pring “called” in the console)
and then again one more time
MYAPP.myevent.addListener(window, 'click', function(){alert('click 2')});(this will not print in the console)
Hope that helps!
S
May 17th, 2009 at 9:34 am
[...] OpenSearch-enabling your blog / phpied.com (tags: tutorial php blog plugin webdev opensearch firefox) [...]
August 30th, 2009 at 8:07 pm
[...] OpenSearch-enabling your blog / phpied.com http://www.phpied.com/opensearch-enabling-your-blog – view page – cached Stoyan’s blog about (x)html, ajax, bookmarklets, browsers, css, firebug, javascript, json, mdb2, mysql, pear, performance, php, phpbb, tools, yslow, yui, writing, music,… life and everything. — From the page [...]
December 14th, 2010 at 3:01 pm
“This functionality is following the open search standard.”
What I can not believe!