Use google search's Ajax api

Source: Internet
Author: User

In the last two months, I visited google and learned what the great GFW has done. Although the form is not optimistic, it still shows that the dog released the google adsense api and google search ajax api. Obviously, the latter is more practical. Therefore, I applied for an api key by using thunder, but after referring to online manual, I 'd like to talk with the actual code: Copy codeThe Code is as follows: function OnLoad (){
// Create a search control
Var searchControl = new GSearchControl ();

// Search option, which is set to auto expand
Var options = new GsearcherOptions ();
Options. setExpandMode (GSearchControl. EXPAND_MODE_OPEN );

// Added a Webpage Search
SearchControl. addSearcher (new GwebSearch (), options );

// Search result output options. GSearchControl. DRAW_MODE_TABED is another option in the list. Various search results are displayed in tab mode.
Var drawOptions = new GdrawOptions ();
DrawOptions. setDrawMode (GSearchControl. DRAW_MODE_LINEAR );

// Display 8 search results at a time
SearchControl. setResultSetSize (GSearch. LARGE_RESULTSET );
// Tell the searcher to draw itself and tell it where to attach
SearchControl. draw (document. getElementById ("searchcontrol"), drawOptions );

// Start searching
SearchControl.exe cute ("Google ");
}

The current version of this api is 0.1. After the official version 1.0 is released, there will be ads in the search results. Obviously, this lunch is not free.

  • Here I wrote the demo (if not accessible, it means google is getting started again)-http://www.ooso.net/temp/demo/search.html
  • Google AJAX Search API example

Http://code.google.com/apis/ajaxsearch/documentation/#AdvancedSamples

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.