【问题标题】:use google to search in a url使用 google 在 url 中搜索
【发布时间】:2012-09-03 13:34:23
【问题描述】:

我想使用 Google 搜索我的网址。我想使用这些代码:

site: http://my-url.ir/ my_words_that_want_to_search

然后我有一个文本输入和一个搜索按钮

我希望 HTML(或 JavaScript)在我单击按钮时将文本输入中的文本放入

site: http://my-url.ir/ text_that_is_in_text_input

【问题讨论】:

  • 我认为不可能,如果是,那么您将如何显示结果?
  • @Mayankswami 我认为他的意思更像是使用关键字重定向到谷歌本身,但过滤到他的site:,就像w3 org

标签: javascript textinput google-search


【解决方案1】:

查看Google Custom Search Engine,它将为您创建此类代码 sn-ps。

根据this query string anatomy,您可以只添加另一个参数,而不是在搜索字符串中添加site:xyz

<form method="GET" action="//www.google.de/search">
    <input type="hidden" name="as_sitesearch" value="http://example.com">
    <input type="text" name="q">
    <input type="submit" value="Search!">
</form>

简单的搜索表单无需使用 JavaScript。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-07
    • 2016-12-02
    • 1970-01-01
    • 1970-01-01
    • 2020-03-19
    • 2013-01-30
    • 2014-10-01
    相关资源
    最近更新 更多