I know how to add a Google Search Box to my website, but how can I add the Image Search from Google?
Let’s take a look at a standard search url from Google:
Now, let’s strip that one down to right the bare essential:
The extra info in the string tells Google which website you come from (source=ig -> iGoogle), what language you speak (hl=en), and what the button says (btnG=Google+zoeken)
Now… If you try an image search on Google, and translate to a “bare essentials url” as we did above, we get:
So, to get Google’s Image Search result page, with the results that your website’s visitor is looking for, you actually only need one (1) thing in a form: a textfield, with the name ‘q’, which contains the keywords for which your visitor wants to search images.
Putting this all together in nice and clean HTML this results into this:
< form method="get" action="http://images.google.com/images" > < input type="text" name="q" / > < input type="submit" value="Search Google Images" / > < /form >
Or looking like this:
Now, if you don’t want the result page from Google’s images to open instead of your own website, add the optional attribute target=”_NEW” to the form tag, making it