首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何实现chromium?

如何实现chromium?
EN

Stack Overflow用户
提问于 2021-01-18 19:50:18
回答 1查看 223关注 0票数 0

我正在尝试通过使用opensearch在我的网站URL上实现Tab搜索。我遵循了openSearch文档中的步骤,但仍然不适用于我。请帮我找出我遗漏了什么。

我的XML文件:

代码语言:javascript
复制
<?xml version="1.0"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
 <ShortName>localhost</ShortName>
 <Description>Search localhost</Description>
 <Url type="text/html" method="get" template="localhost:8080/?query={searchTerms}"/>
</OpenSearchDescription>

我在index.html文件中的Head标记是:

代码语言:javascript
复制
<!doctype html>
<html>
<head>
    <link rel="search"
          type="application/opensearchdescription+xml"
          title="Google IFL"
          href="tabToSearch.xml">
 </head>

结果:每当我按Tab键时,它都会跳转到下一个url在此处输入图像描述

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-20 23:04:47

结构是正确的,问题是您忘记在模板中添加http协议。如果没有这个协议,它就不会被添加到chrome中。

代码语言:javascript
复制
-  <Url type="text/html" method="get" template="localhost:8080/?query={searchTerms}"/>
+  <Url type="text/html" method="get" template="http://localhost:8080/?query={searchTerms}"/>

一旦你这样做了,你将能够在Chrome自定义搜索引擎设置中看到它。

但是,当您尝试搜索localhost而不是localhost:8080时,它将会起作用。它仍然会在搜索中使用好的端口。这是因为搜索关键字没有端口。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65773991

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档