opensearch_将OpenSearch添加到您的网站并进入浏览器的搜索框

opensearch

opensearch

I was over at http://search.twitter.com earlier today and I noticed the Search Box in Firefox had a blue lit-up dealie:

我今天早些时候在http://search.twitter.com结束了,我注意到Firefox中的搜索框有一个蓝色的亮点。

image

Hm...OK. What's that? I hit another site and didn't see it. Weird. Ok, View-Source then, what drives you little blue thing?

嗯...好。 那是什么? 我访问了另一个网站,但没有看到它。 奇怪的。 好吧,那么查看源代码,是什么促使您感到沮丧呢?

<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Twitter Search">

Hey, that's not something I've seen before. What's in it...http://search.twitter.com/opensearch.xml...

嘿,那不是我以前见过的东西。 里面有什么... http://search.twitter.com/opensearch.xml ...

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Twitter Search</ShortName>
<Description>Realtime Twitter Search</Description>
<Url type="text/html" method="get" template="http://search.twitter.com/search?q={searchTerms}"/>
<Image width="16" height="16">http://search.twitter.com/favicon.png</Image>
<InputEncoding>UTF-8</InputEncoding>
<SearchForm>http://search.twitter.com/</SearchForm>
</OpenSearchDescription>

Ah! I totally get it. Excellent. I shall make my own immediately! I added this file to my website and added a <link> line as seen in the first example above that pointed to it.

啊! 我完全明白。 优秀的。 我将立即做自己的! 我将此文件添加到我的网站,并添加了<link>行,如在上面的第一个示例中所指向的。

<?xml version="1.0" encoding="UTF-8" ?> 
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Hanselman Search</ShortName>
<Description>Search Scott Hanselman's Blog</Description>
<Url type="text/html" method="get" template="http://www.hanselman.com/blog/...snip...q={searchTerms}"/>
<Image width="16" height="16">http://www.hanselman.com/blog/favicon.ico</Image>
<InputEncoding>UTF-8</InputEncoding>
<SearchForm>http://www.hanselman.com/</SearchForm>
</OpenSearchDescription>

Bam.

am

image

I wonder if it works in IE7?

我想知道它是否可以在IE7中使用吗?

image

Pow! I wonder if Live.com supports it?

ow! 我想知道Live.com是否支持它?

image

Eek! FAIL. I'll mention that to someone at Live.com

ek! 失败。 我会在Live.com上向某人提及

OpenSearch is a really easy feature that you can add to your website in literally minutes. Seconds if you type fast. Check me out noticing this only three years late. :)

OpenSearch是一项非常简单的功能,您可以在几分钟内将其添加到您的网站。 快速输入秒数。 让我注意一下,发现这仅晚了三年。 :)

Give it a try!

试一试!

IMPORTANT NOTES: Make sure you include the first line of the XML file (the XML declaration) or IE will ignore it and nothing will happen when you add it. Also, make sure you include the default XML namespace or Firefox will give you an error: "Firefox could not download the search plugin"

重要说明:确保包括XML文件的第一行(XML声明),否则IE将忽略它,并且在添加时什么也不会发生。 另外,请确保您包括默认的XML名称空间,否则Firefox将给您一个错误:“ Firefox无法下载搜索插件”

翻译自: https://www.hanselman.com/blog/adding-opensearch-to-your-website-and-getting-in-the-browsers-search-box

opensearch

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值