Matt, you need a better solution that lets you control your own cache
interval. Here's how you can do it.

1. Move your JavaScript code into a separate .js file.

2. In the gadget XML, replace the JS code with a document.write that
writes a <script> tag to load your .js file, using a URL obtained via
_IG_GetCachedUrl() and a refreshInterval of your choosing.

3. Remove all other CSS and HTML content from the gadget XML, and use
document.write in your JS file to write out that content.

Now your XML file is a bare skeleton that has only the things that you
can't avoid putting in it. All the code you'd typically need to update
is in the .js file and you control the caching of that file.

Here's an example. The gadget XML is at:

http://election-maps-2008.googlecode.com/svn/trunk/poll411-gadget.xml

And there's a mapplet version too:

http://election-maps-2008.googlecode.com/svn/trunk/poll411-mapplet-gc.xml

You don't have to do the baseUrl stuff that you see in those files; I
had that in there to support multiple versions for testing.

Both versions use this JS file:

http://election-maps-2008.googlecode.com/svn/trunk/poll411-map.js

This version of the code doesn't happen to have any <style> tags in
it, but you can include them in the document.write just like any other
HTML code. You can see a more complete example in the pre-election
version of the code (revision 336):

http://election-maps-2008.googlecode.com/svn-history/r336/trunk/poll411-map.js

To make development easier, make a second copy of your .xml file that
loads a local copy of the .js file (e.g. from localhost or a file:
URL) and includes a cachebuster in the .js file URL. Where the XML
files above have this call:

_IG_GetCachedUrl( url, { refreshInterval:seconds } ),

replace it with:

url, '?', (+new Date),

and make url your local URL.

Now when you use this test copy of the gadget, you'll be loading all
the JS locally and with a timestamp in the URL.

-Mike

On Nov 24, 7:20 am, "Matt (Guru)" <[EMAIL PROTECTED]> wrote:
> Dan,
>
> Would it be possible to delete the cache again? I uploaded a new xml
> last night without realizing that it had a js error in it. So the
> cached version is now dead in the water and thousands of people are
> without a working gadget. I've already uploaded a fixed copy, but it
> won't take effect immediately, of course. Very frustrating!
>
> gadget url:www.javascripttoolbox.com/gadget/marketsummary/marketsummary.xml
>
> Thanks!
>
> Matt Kruse
>
> On Nov 18, 1:02 pm, "Dan (Google Employee)" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi Matt,
>
> > Since I'd consider this an urgent request, I went ahead and deleted
> > the cached copy on my end. It might still take up to 2 hours for this
> > to completely propagate, but after that it should be updated for
> > everyone.
>
> > Best,
> > Dan
>
> > On Nov 18, 9:59 am, "Matt (Guru)" <[EMAIL PROTECTED]> wrote:
>
> > > I have a Finance gadget currently used by about 6,000 
> > > people:http://www.google.com/ig/directory?url=www.javascripttoolbox.com/gadg...
>
> > > Today I got some emails saying it was no longer working. As it turns
> > > out, the source page for the data had changed and my screen-scraping
> > > failed.
>
> > > I quickly updated the gadget and uncached my copy for testing. It
> > > works again!
>
> > > But all my users still hitting the cached version are still broken.
>
> > > Is there any way to quickly re-cache my gadget for all users, so they
> > > don't remove it out of frustration? In general, this would be a very
> > > useful tool for gadget developers. I'd like to go to some "control
> > > panel" and be able to manage my gadgets, update the cached versions,
> > > delete them if I wish, etc.
>
> > > MattKruse
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to