{"id":76,"date":"2008-08-15T00:43:33","date_gmt":"2008-08-14T16:43:33","guid":{"rendered":"http:\/\/blog.lolyco.com\/sean\/?p=76"},"modified":"2008-08-15T00:48:23","modified_gmt":"2008-08-14T16:48:23","slug":"writing-a-search-engine-widget-for-firefox-ie7","status":"publish","type":"post","link":"https:\/\/blog.lolyco.com\/sean\/2008\/08\/15\/writing-a-search-engine-widget-for-firefox-ie7\/","title":{"rendered":"Writing a search engine widget for firefox \/ IE7"},"content":{"rendered":"<p>I had been wondering how difficult it would be to make a search engine widget for <a title=\"Spider.my\" href=\"http:\/\/spider.my\">spider.my<\/a> &#8211; there&#8217;s so much important stuff yet to be done, but I got distracted by the gloss! The great news is &#8211; very easy! You can visit spider.my now and add its search engine to your toolbar in Firefox or IE7. If you&#8217;re looking at the spider.my homepage, it&#8217;s as easy as it looks in this image:<\/p>\n<div style=\"width: 364px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/spider.my\/\"><img loading=\"lazy\" decoding=\"async\" title=\"Adding the Search Engine from Spider.my in Firefox\" src=\"http:\/\/blog.spider.my\/wp-content\/uploads\/2008\/08\/spidermyse_menu.jpeg\" alt=\"Adding the Search Engine from Spider.my in Firefox\" width=\"354\" height=\"309\" \/><\/a><p class=\"wp-caption-text\">Adding the Search Engine from Spider.my in Firefox<\/p><\/div>\n<p>I used the <a title=\"OpenSearch at Mozilla\" href=\"http:\/\/developer.mozilla.org\/en\/docs\/Creating_OpenSearch_plugins_for_Firefox\">OpenSearch plugin format<\/a> to create spider.my&#8217;s first search engine plugin. There are others, but Mozilla tells me:<\/p>\n<blockquote><p>Plugins that use the <a class=\"external text\" title=\"http:\/\/www.opensearch.org\/Specifications\/OpenSearch\/1.1#OpenSearch_description_document\" href=\"http:\/\/www.opensearch.org\/Specifications\/OpenSearch\/1.1#OpenSearch_description_document\">OpenSearch description syntax<\/a> are compatible with IE 7 and Firefox. Because of this, they are the recommended format for use on the web.<\/p><\/blockquote>\n<p>And it is just as easy to add the Search Engine widget from your site for visitors using IE7:<\/p>\n<div id=\"attachment_93\" style=\"width: 373px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/spider.my\/\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-93\" class=\"size-full wp-image-93\" title=\"Spider.my Search Engine in IE7\" src=\"http:\/\/blog.lolyco.com\/sean\/wp-content\/uploads\/2008\/08\/spidermyse_menuie7.jpeg\" alt=\"Adding the spider.my Search Engine in IE7\" width=\"363\" height=\"267\" \/><\/a><p id=\"caption-attachment-93\" class=\"wp-caption-text\">Adding the spider.my Search Engine in IE7<\/p><\/div>\n<p>There are two essential ingredients to advertising a search engine widget on your site: an XML document that describes the Search Engine, and a LINK element in the HTML of the pages you&#8217;d like the Search Engine to be provided from.<\/p>\n<h3>First ingredient &#8211; the XML OpenSearch description file<\/h3>\n<p>The file is very simple. If, like me, you&#8217;re only interested in providing a basic search widget without &#8216;search suggestions&#8217;, you need only create a file like:<\/p>\n<pre>&lt;OpenSearchDescription\r\n  xmlns=\"http:\/\/a9.com\/-\/spec\/opensearch\/1.1\/\"\r\n  xmlns:moz=\"http:\/\/www.mozilla.org\/2006\/browser\/search\/\"&gt;\r\n&lt;ShortName&gt;<strong>engineName<\/strong>&lt;\/ShortName&gt;\r\n&lt;Description&gt;<strong>engineDescription<\/strong>&lt;\/Description&gt;\r\n&lt;InputEncoding&gt;<strong>inputEncoding<\/strong>&lt;\/InputEncoding&gt;\r\n&lt;Image width=\"16\" height=\"16\"&gt;<strong>imageURI<\/strong>&lt;\/Image&gt;\r\n&lt;Url type=\"text\/html\" method=\"<strong>method<\/strong>\" template=\"<strong>searchURL<\/strong>\"&gt;\r\n&lt;moz:SearchForm&gt;<strong>searchFormURL<\/strong>&lt;\/moz:SearchForm&gt;\r\n&lt;\/OpenSearchDescription&gt;<\/pre>\n<p><strong>engineName<\/strong> is <em>My Spider<\/em> for spider.my<\/p>\n<p><strong>engineDescription<\/strong> is <em>My Spider (spider.my)<\/em> &#8211; although I have yet to see this appear anywhere!<\/p>\n<p><strong>inputEncoding<\/strong> is for you to decide. A popular encoding used on the backend of spider.my is <em>UTF-8<\/em>, so that&#8217;s what I use for the Search Engine widget.<\/p>\n<p><strong>imageURI<\/strong> is interesting &#8211; I just used a plain old URL to locate the <a title=\"Favicon at Dummipedia\" href=\"http:\/\/www.dummipedia.org\/Favicon\">favicon<\/a> for spider.my, but you can use a data: URI too. The mozilla page includes a link to <a class=\"external text\" title=\"http:\/\/software.hixie.ch\/utilities\/cgi\/data\/data\" rel=\"nofollow\" href=\"http:\/\/software.hixie.ch\/utilities\/cgi\/data\/data\">the data: URI kitchen<\/a><\/p>\n<p><strong>method<\/strong> for spider.my is <em>GET<\/em> and <strong>searchURL<\/strong> is the URL your browser sends when you enter some text in the spider.my search page and click &#8216;Ask My Spider&#8217;. To mark the spot where a user&#8217;s search input goes, use &#8216;{searchTerms}&#8217;. The <strong>searchURL<\/strong> for spider.my is <em>http:\/\/spider.my\/Search?q={searchTerms}<\/em><\/p>\n<p>If it&#8217;s really not obvious what to replace with what, compare this template with <a title=\"Search Engine widget XML file\" href=\"http:\/\/spider.my\/static\/tools\/SE.xml\">the actual XML file for spider.my <\/a><\/p>\n<h3>Second ingredient &#8211; telling the user&#8217;s browser the widget exists<\/h3>\n<p>To notify your users&#8217; browsers, simply add a LINK element to the pages you&#8217;d like them to pick up the Search engine from. As I&#8217;m only testing out ideas on spider.my, I put the LINK element on the homepage only. I might at a later date add the LINK to all the pages at spider.my (or specifically the Search pages &#8211; who knows?).<\/p>\n<p>Here&#8217;s the LINK element from spider.my&#8217;s homepage:<\/p>\n<pre id=\"line1\">&lt;<span class=\"start-tag\">link<\/span><span class=\"attribute-name\">\r\n  rel<\/span>=<span class=\"attribute-value\">\"search\" <\/span><span class=\"attribute-name\">type<\/span>=<span class=\"attribute-value\">\"application\/opensearchdescription+xml\"\r\n<\/span><span class=\"attribute-name\">  title<\/span>=<span class=\"attribute-value\">\"My Spider\" <\/span><span class=\"attribute-name\">href<\/span>=<span class=\"attribute-value\">\"\/static\/tools\/SE.xml\"<\/span>&gt;<\/pre>\n<p>You need only change the title and href attributes for your own installation. The href tells your visitors browser where you put that XML file you created. That&#8217;s it! Next time you load the page from your site, you&#8217;ll be able to add your site&#8217;s Search Engine to Firefox and IE7 with a simple click!<\/p>\n<p>There are more options that can be added to the search engine, but it seems they&#8217;re better supported, or even unique to Firefox. Since I&#8217;m aiming spider.my squarely at Web 0.2, I won&#8217;t be doing any of that new-fangled stuff.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had been wondering how difficult it would be to make a search engine widget for spider.my &#8211; there&#8217;s so much important stuff yet to be done, but I got distracted by the gloss! The great news is &#8211; very easy! You can visit spider.my now and add its search engine to your toolbar in [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,11,36,35],"tags":[37,38,112,111],"class_list":["post-76","post","type-post","status-publish","format-standard","hentry","category-fixed","category-google","category-search","category-spidermy","tag-firefox","tag-ie7","tag-search","tag-spidermy"],"_links":{"self":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/comments?post=76"}],"version-history":[{"count":11,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/76\/revisions"}],"predecessor-version":[{"id":101,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/76\/revisions\/101"}],"wp:attachment":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/media?parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/categories?post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/tags?post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}