【问题标题】:more efficient and expandable google search更高效和可扩展的谷歌搜索
【发布时间】:2011-09-02 04:52:30
【问题描述】:

我有一个带有复选框的大量网站,我想使用这些复选框来缩小 Google 搜索范围。现在我的脚本仅限于大约 5 个站点,我猜只是因为 Firefox 或 google 或其他的一些长度限制。反正我的脚本是这样的

function search_google(){           
        var cbs = document.getElementsByTagName('input');
        var txt = document.search.query.value;
        var sites = " ";
        for(var i=0; i < cbs.length; i++) {
            if(cbs[i].type == 'checkbox' && cbs[i].checked && cbs[i].value != "yes") {
                sites = sites + "site:" + cbs[i].value + " OR ";
            }
        }
        sites = sites.substring(0, sites.length - 4);
        window.open("http://www.google.com/search?q="+ " " + txt + sites);
    }

我查看了自定义谷歌搜索,但看起来这需要您提前指定所有网站,然后即时自定义谷歌搜索需要支付月费。那么是否有人有一种可扩展的方式来搜索大量特定网站?

【问题讨论】:

    标签: javascript html google-search


    【解决方案1】:

    网址有一个最大长度。你超过了这个限制。

    What is the maximum length of a URL in different browsers?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-28
      • 2021-06-20
      • 1970-01-01
      • 2012-08-24
      • 1970-01-01
      • 2010-10-30
      • 2010-09-19
      相关资源
      最近更新 更多