articles

Home / DeveloperSection / Articles / Google Search API on HTML Page

Google Search API on HTML Page

Vijay Shukla 5081 08-May-2013

In this article I am trying to explain how to implement simple Google search on HTML page.

The fundamental method involved here is to be able to manipulate the variables handed to the Google search engine, this variable called sitesearch. If you set it to a null in the sitesearch variable then you able to search the entire World Wide Web, but if you set it to a specific domain and it's forced exactly as if you had typed in the Google special notation.

Below is the code for implement simple Google search:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>MindStick©</title>
</head>
<body>
    <form method="get" action="http://www.google.com/search">
    <input type="text" name="q" size="40" maxlength="255" value="" />
    <input type="submit" value="Google Search" />
    <input type="radio" name="sitesearch" value="" />
    The Web
    <input type="radio" name="sitesearch" value="mindstick.com" checked />
    Search from MindStick®<br />
    </form>
</body>
</html>
 Output:-


Google Search API on HTML Page

In above image I type "Ajax" and click on the Google Search if you select the "Search from MindStick" radio button then it will search only from the "www.mindstick.com" website. But if I select "The Web" then search the Ajax content form www (World Wide Web).

After clicking the Google Search button:-

Google Search API on HTML Page

 


Updated 07-Sep-2019

Leave Comment

Comments

Liked By