2013-07-25 5 views
5

オムニボックスを使って自分のドメインでのみ検索できるように自分のウェブサイトを設定するにはどうすればよいですか?chrome omniboxドメインに検索を追加する方法

例:

  • 型youtube.com、私はVimeoのにしようと enter image description here
  • を押すこと

を動作しないでしょうその後、yahoo.comを enter image description here

  • タブを押すか、入力ソースコードでは何も見つからなかった。

  • 答えて

    2

    はい、可能です。 私はこれを私のブログにしました。

    <?xml version="1.0"?> 
    <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> 
        <ShortName>The Sheng Blog (Beta)</ShortName> 
        <Description>The Sheng Blog Search</Description> 
        <Developer>Sheng Slogar</Developer> 
        <LongName>Search the entire Sheng Blog</LongName> 
        <InputEncoding>UTF-8</InputEncoding> 
        <OutputEncoding>UTF-8</OutputEncoding> 
        <Query role="example" searchTerms="code"/> 
        <SyndicationRight>open</SyndicationRight> 
        <AdultContent>false</AdultContent> 
        <Language>en-us</Language> 
        <Contact>[email protected]</Contact> 
        <Tags>code posts tutorials ideas playground</Tags> 
        <Image width="16" height="16" type="image/x-icon">data:/ico;base64,AAABA...(Icon in base64)</Image> 
        <Url type="text/html" template="http://theshengblogg.comule.com/search.php?s={searchTerms}"></Url> 
        <Url type="application/x-suggestions+json" method="GET" template="http://theshengblogg.comule.com/autocomplete.php?search={searchTerms}&amp;json=true"/> 
    </OpenSearchDescription> 
    

    私はhttp://www.opensearch.org/Specifications/OpenSearch/1.1からこのことを学んだ:

    <link rel="search" type="application/opensearchdescription+xml" title="The Sheng Blog" href="/resources/opensearch.php"/> 
    

    opensearch.phpが好きこれを探します。オートコンプリート部分はオプションです。 JSON形式で返します。

    たとえば、「a」を検索すると、["a"、 "about"、 "across"、 "all"、 "and"]が返されます。 (私はあなたのクエリを項目0として配列に入れます)。

    私のオートコンプリートはFirefoxでしか動作しないようです。これは私のサブドメインのものかもしれません。 IEやChromeでも動作させることができませんでした。

    2

    http://dev.chromium.org/tab-to-searchには、これを行う方法に関する情報がありますが、クロームアドオンを使用してページにこれを機能させるために必要なコードを強制する可能性がありますが、そのように機能するかどうかはわかりません。

    関連する問題