Showing posts with label igoogle. Show all posts
Showing posts with label igoogle. Show all posts

Sunday, March 30, 2008

Prevent _IG_FetchContent from caching data

_IG_FetchContent is a Java Script function provided by Google for facilitating iGoogle's Gadget development. Its function is simply to fetch data from a HTTP location.
_IG_FetchContent('http://www.google.com/', function (responseText) {
// do something
}
);

However, the HTTP request is NOT directly send from client to web server of that location like most AJAX calls. Google itself cache the content too. Which cause problems for Gadgets which need dynamic data.

To prevent Google from caching the data, the third parameter which is refreshInterval has to be specified.
_IG_FetchContent('http://www.google.com/', function (responseText) {
// do something
}
,{ refreshInterval: 1 });
The '1' means that the content at this location is cached for one second. Which is a reasonable amount of time.