HOWTO: Link to Google Search with hidden site: parameter

I was trying to hack up a little search box to access the local Google search appliance. I know you can search with a query like “foo site:example.com/docs” but I wanted to pass site: in as a form parameter. Here is an example of how to do that:

<form action="http://googleplex.example.com/search">
    <input type="text" name="q" />
    <input type="hidden" name="as_sitesearch" value="example.com/docs" />

So, where you might use site: in the search field, you use as_sitesearch as a hidden search parameter. I figured this out by squinting at the Google Advanced Search page.

Read More

Categories: Technical