cutmail's blog

write the code

Firefoxの検索プラグインを作ってみる

不思議なピクミーという検索ツールを使っていたりするのですが、
サイト上のフォームからしか検索できず、めんどくさいと感じたので、
下のサイトを参考に作ってみた。
Creating OpenSearch plugins for Firefox - MDN

コーディング

実際には、xmlファイルとして保存します。
中身はこんな感じ。

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                       xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>不思議なピクミー</ShortName>
<Description>不思議なピクミーの検索プラグイン</Description>
<InputEncoding>EUC-JP</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,imageData</Image>
<Url type="text/html" method="get" template="http://picmy.jp/search?Keywords={searchTerms}">
</Url>
<Url type="application/x-suggestions+json" template="http://picmy.jp/search?Keywords={searchTerms}"/>
<moz:SearchForm>http://picmy.jp/search?Keywords={searchTerms} </moz:SearchForm>
</OpenSearchDescription>

{searchTerms}というところに、ブラウザの検索フォームに入力した語句が入ります。
その他の細かい書式については、参考にしたリンク先を見てください。

サンプル

下のリンクよりインストールできます。
demo