Bastiat
Bastiat

Reputation: 787

more efficient and expandable google search

I have a large list of websites with checkboxes that I want to use to narrow a google search. right now my script it limited to about 5 sites I guess just because of some length limit on firefox or google or whatever. anyway my script looks like this

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);
    }

I have looked at custom google search but it looks like that requires that you specify all the sites ahead of time and then custom google search on the fly required a monthy fee. So does anyone have a bettwe expandable way to search a large list of specific sites?

Upvotes: 0

Views: 74

Answers (1)

GAgnew
GAgnew

Reputation: 4083

Urls have a maximum length they can be. Your going over that limit.

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

Upvotes: 1

Related Questions