Yikes, don't use a random number for this. All refreshInterval really does
is add a timestamp divided by the number of seconds specified to wait
between refreshes to the url. You can get the same effect by doing:
var refreshInterval = 10;
var ts = new Date().getTime();
var sep = "?";
if (refreshInterval > 0) {
ts = Math.floor(ts / (refreshInterval * 1000));
}
if (url.indexOf("?") > -1) {
sep = "&";
}
url = [ url, sep, "nocache=", ts ].join("");
Anyway, _IG_FetchContent is deprecated and you shouldn't use it. The
gadgets.* method is preferable here (and the REFRESH_INTERVAL parameter
should work):
var url = "http://example.com";
var opts = {
"REFRESH_INTERVAL" : 10
}
function callback(response) {
...
};
gadgets.io.makeRequest(url, callback, opts);
Hope this helps,
~Arne
On Tue, Sep 1, 2009 at 9:20 AM, Bas <[email protected]> wrote:
>
> I solved the caching problem with a work around.
>
> var url += '&rand=' + Math.ceil(Math.random() * 1000);
>
> But hopefully this will be fixed!
>
> Cheers,
> Bas
>
>
> On Aug 31, 10:19 pm, Bas <[email protected]> wrote:
> > If I fetch content I use the option refreshInterval to set the caching
> > interval. This was working perfectly, but is no longer working
> > alright. An example:
> >
> > _IG_FetchContent(url, function(response) {
> > if(response) {
> > var json = eval("(" + response + ")");
> > ShowResponse(json);
> > }
> >
> > }, { refreshInterval: 10});
> >
> > I keep getting the cached content and not the new content. Is there a
> > problem with this function?
> >
> > Thanks,
> > Bas
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---