tags:

views:

30

answers:

1

Hi,

Is it possible to use Google AJAX API : on local google search engine for example : google.es

or is it only working for google.com?

Thanks for helping.

A: 

It is possible, and there are a few ways to do it.

See this entry on Googles AJAX API blog.

There are three possible ways to implement, depending on how you're using the API:

  1. If you use the loader, you can simply load jsapi on the domain you're interested in (example), such as:

  2. Alternately, you can set this with the web search object's .setRestriction method (example):

    var ws = new google.search.WebSearch(); ws.setRestriction(google.search.Search.RESTRICT_EXTENDED_ARGS, {'gl' : 'es'});

  3. Finally, if you're using the RESTful interface, all you have to do is append a "gl" URL parameter to your request:

    http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=flowers&gl=fr

Brandon
When I use google.fr to search the keyword "flowers" : The first site found is :www.1800flowers.comWhereas when it comes to Google AJAX API with the "gl=fr" parameter , the first web site is :http://www.flowercampings.comI want Google AJAX API to give me the same order as if i was doing a manual searching.
Anonymous