搜索框微格式?

发布于 2024-10-02 16:37:56 字数 64 浏览 1 评论 0原文

是否有任何微格式/标准用于在网站上实现搜索表单?
(访问密钥、命名等)

有什么好的做法吗?

Is there any microformat/standard for implementing search form on the site?
(access keys, naming etc.)

Any good practices?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柒七 2024-10-09 16:37:56

我唯一能想到的是搜索应该是 GET 请求,并且您可能想要实现一个 RESTful API,允许开发人员除了 HTML 之外还查询 JSON 和 XML 结果

如果您正在尝试为 IE 等浏览器实现一个插件和 Firefox 允许在浏览器的搜索框中进行搜索/自动完成,请查看以下内容: https://developer .mozilla.org/en/creating_opensearch_plugins_for_firefox

The only things I can think of are that searches should be GET requests, and that you may want to implement a RESTful API that allows developers to query JSON and XML results in addition to HTML

If you are trying to implement a plugin for browsers like IE and Firefox to allow for search/autocomplete in the search box of the browser, check out this: https://developer.mozilla.org/en/creating_opensearch_plugins_for_firefox

柳若烟 2024-10-09 16:37:56

以下是我遵循的一些约定。如果这些与微格式主题不完全相关,或者以我描述答案各个部分的方式“技术上不是”,请原谅我。

我在从其他人复制的这几个标准中找到了验证:

HTML 表单 ID = "search"

表单的操作 URL 为 //root-of-site/search/

搜索结果 URL 构造:

//root-of-site/search?q=queryClause1+Clause2&AnotherParamName=foo

[就我个人而言,该结构让我有点不舒服,因为搜索前斜杠似乎是一个目录,搜索问号看起来像一个带有查询字符串的页面,并且 IMO 页面应该有一个后缀。我一直想使用 search.cgi 或 search.app,但我看到大佬们使用 /search?q=,所以它是]

搜索查询的 ID 是“q”(这在采用中几乎是普遍的)

Here are some conventions I follow. Forgive me if these are not exactly on topic with microformats, or "technically not" in the way I describe the various parts to my answer.

I have found validation in these few standards I've copied from others:

HTML form ID = "search"

Action URL for the form is //root-of-site/search/

Search Results URL construct:

//root-of-site/search?q=queryClause1+Clause2&AnotherParamName=foo

[personally that structure bugs me a little because search-forward-slash appears to be a directory, and the search-question-mark looks like a page taking a query string, and IMO a page should have a suffix. I've been tempted to use search.cgi or search.app, but I see the big guys using /search?q= and so it is]

ID of search query is "q" (this is nearly universal in adoption)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文