偶尔有时使用下firefox,偶尔也会去自己的blog搜索下之前的文档,看到firefox上的搜索工具栏就想写个专门针对自己blog搜索的搜索插件,go大神 + MDN 的文档将这个想法很快就实现了,下面分享下。
编写firefox的工具栏搜索插件目前可以使用3种方式,下面一一介绍,将针对本blog的文章搜索为例,例如iteye的blog搜索url为 http://dikar.iteye.com/blog/search?query=xxxx ,xxxx就是可以替换的关键词了。
插件环境:
本机使用fedora 11 系统,firefox版本为 3.5.9 firefox的用户数据目录为 /home/dikar/.mozilla 所有的搜索插件存放位置为 /home/dikar/.mozilla/firefox/s1tk7mcl.default/searchplugins,插件编写修改都需要重启firefox来验证。
本文做如下定义 $SE_PLUGIN_D 表示搜索插件的存放目录。
使用快捷键 Ctrl +K 可以快速定位到网页搜索工具栏
1:比较早但是firefox还支持的方法(引自 ref 1)
<search
name="dikM"
method="GET"
action="http://dikar.iteye.com/blog/search"
queryCharset="utf-8"
>
<input name="query" user>
</search>
将该代码保存为myBlog.src文件放置在$SE_PLUGIN_D,注意不是xml文件,然后启动Firefox看效果。
这种格式firefox还支持,但是会内部转化为新的标准格式生成对应的myBlog.xml,你可以看下新的格式标准。
注意这种方法没有设置icon,所以你工具栏中没有icon显示。
2:比较早的OpenSearchPlugin规范(引自 ref 2)
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>myBlog</ShortName>
<Description>my iteye blog</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">data:image/x-icon;base64,R0lGODlhEAAQALMOAP8RAP///2ZmZv+IgP/Dv/9cUP/h3/8gEP9NQP8+MP8vIP/Sz/+0r/+lnwAAAAAAACH5BAEAAA4ALAAAAAAQABAAQARN0MnpAKDYlsFNINZkAUVgBiNGjawgqOOBhDDAmItJHFc9nIFCquZS1YYZjQdFE1kIAQOPlSwBA42mZKQAJDwgbQXw+8wsr+SoaJSwjREAOw==</Image>
<Url type="text/html" method="get" template="http://dikar.iteye.com/blog/search">
<Param name="query" value="{searchTerms}"/>
</Url>
</OpenSearchDescription>
主要的语法可以参见ref 2中的说明
保存为myBlog.xml放置在$SE_PLUGIN_D 然后重启FF看效果
3:目前的标准(引自各种go)
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>myBlog</os:ShortName>
<os:Description>my blog search</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQALMOAP8RAP///2ZmZv+IgP/Dv/9cUP/h3/8gEP9NQP8+MP8vIP/Sz/+0r/+lnwAAAAAAACH5BAEAAA4ALAAAAAAQABAAQARN0MnpAKDYlsFNINZkAUVgBiNGjawgqOOBhDDAmItJHFc9nIFCquZS1YYZjQdFE1kIAQOPlSwBA42mZKQAJDwgbQXw+8wsr+SoaJSwjREAOw==</os:Image>
<os:Url type="text/html" method="GET" template="http://dikar.iteye.com/blog/search?query={searchTerms}">
</os:Url>
</SearchPlugin>
保存为myBlog.xml放置在$SE_PLUGIN_D 然后重启FF 看效果
总结:2和3的语法差不多,看xmlns 也是一样的,所以基本的参数设置查不多
参考:
1:Learn to Create a Firefox Search Plugin in Less Than 2 Minutes
2:Creating OpenSearch plugins for Firefox
分享到:
相关推荐
pdf reader firefox plugin
firefox plugin程序 编译SDK npruntime代码
gwt firefox13 plugin
gwt - dev - firefox16 plugin
firefox3.6.4之前的版本,都只占用单一进程,从3.6.4开始,firefox多了一个plugin-container.exe进程,这个是那些浏览网页所需要的插件运行的进程。 分离进程最大的好处就是可以防止大面积崩溃。3.6.4之前的fire...
NULL 博文链接:https://smartgwt.iteye.com/blog/1250748
firefox plugin 实例nprt, 用xulRunner sdk 14. 在firefox 14.0.1 + xp上测试test.html成功.
资源全名:Firefox 3.6.3plugin1.dmg
firefox plugin develop pdf
使用firefox 浏览GWT应用的 浏览器插件gwt-dev-plugin.xpi
elasticsearch-plugin-bundle, 一组有用的Elasticsearch插件 Elastisearch的插件包 这个插件是以下插件的组合:elasticsearch-analysis-autophraseelasticsearch-analysis-baseformela
"description": "ActiveX hosting plugin for Firefox r37", "plugins":[{"path": "npffax.dll", "public": true}] } 在Chrome中点选 扳手 -> 工具 -> 扩展程序 在界面上 点选 载入正在开发的扩展程序 将目录定位到...
这个文档是个人在开发100工具时总结出来的文档,部分内容摘自他人,只供学习
Firefox26 和 GWT-Dev_plugin firefox26,亲测可用。。。。
GWT-Dev_plugin firefox26 免费下载,GWT 火狐插件。GWT-Dev_plugin firefox26 版本
使用checkout tag: v5.1.2git checkout v5.1.2运行gradle buildPluginZip创建 directory ${path.home}/plugins/jieba复制zip 文件到分词插件cp build/distributions/elasticsearch-jieba-plugin-5.1.2.zip ${...
gwt-dev-plugin是GWT针对浏览器的安装插件,包含IE、FireFox、Chrome的。不需要的匆下,非学习文档
ranger-2.1.0-elasticsearch-plugin.tar.gz
GWT调试插件,适用于firefox3.x GWT浏览器插件 gwt-dev-plugin for Firefox3.0