搜索框微格式?
是否有任何微格式/标准用于在网站上实现搜索表单?
(访问密钥、命名等)
有什么好的做法吗?
Is there any microformat/standard for implementing search form on the site?
(access keys, naming etc.)
Any good practices?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我唯一能想到的是搜索应该是 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
以下是我遵循的一些约定。如果这些与微格式主题不完全相关,或者以我描述答案各个部分的方式“技术上不是”,请原谅我。
我在从其他人复制的这几个标准中找到了验证:
HTML 表单
ID = "search"
表单的操作 URL 为
//root-of-site/search/
搜索结果 URL 构造:
[就我个人而言,该结构让我有点不舒服,因为搜索前斜杠似乎是一个目录,搜索问号看起来像一个带有查询字符串的页面,并且 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:
[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)