google.load generates new url each time, preventing caching

602 views
Skip to first unread message

Peter

unread,
Feb 7, 2011, 3:38:44 PM2/7/11
to Google Visualization API
Everytime my code loads the visualization library via google.load a
different url is requested, preventing local caching. This is adding
112k to every page request. Some examples:

https://www.google.com/uds/api/visualization/1.0/e8fe9d2ccef9081d9084efd126b680ab/default,corechart.I.js
https://www.google.com/uds/api/visualization/1.0/238b7a4e10c0105f0d75b696f632c882/default,corechart.I.js

If you save the piechart example to a html file and refresh the page
in your browser you'll see the same thing in fiddler2:
http://code.google.com/apis/visualization/documentation/gallery/piechart.html#Example

roger

unread,
Feb 26, 2011, 8:35:38 AM2/26/11
to Google Visualization API
I'm having the same problem. The loader (jsapi) stays in the cache,
but the corechart .js file is downloading everytime. It's a 296KB file
so it's slowing down a couple of my pages by 3-6 secs.

In my case the URL isn't changing but the response headers for "Cache-
Control" (private, max-age=0) and "Expiration" indicate that the file
expires from the cache immediately. The pages load quickly when
caching is working; but these last few days it's consistently
reloading.

Henk

unread,
Feb 27, 2011, 5:49:21 AM2/27/11
to Google Visualization API
Excactly the same problem. The corechart file is by large the biggest
file to download and is the slowest process in my pageload.

I tried dynamically loading as I do not need the file allways, but if
I do a google.load('visualization', '1', {packages:['corechart',
'table']}); after pageload at some point in time I end up with a
blank screen (body is empty) which never ends loading.

Would love to have a solution cause this is really slowing things
down.

Viz Kid

unread,
Mar 7, 2011, 2:09:59 AM3/7/11
to google-visua...@googlegroups.com

Thanks for reporting this issue.
This is indeed a problem and we are working on solving it.

Best,
  Viz Kid

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


Viz Kid

unread,
Mar 25, 2011, 2:40:08 AM3/25/11
to google-visua...@googlegroups.com

Hi all.

I'm happy to say that this problems is now resolved - the caching should now work as intended.
Please let us know if the issue still persists for you.

Best,
  Viz Kid

Henk

unread,
Mar 26, 2011, 9:53:02 AM3/26/11
to Google Visualization API
> Please let us know if the issue still persists for you.

Unfortunately: yes.

a
google.load("visualization", "1", {packages: ["corechart"]});
at some undefined moment after pageload still gives a blank screen

and if I use the jquery getscript method:
$.getScript("http://www.google.com/jsapi?autoload=%7B%22modules%22%3A
%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C
%22packages%22%3A%5B%22corechart%22%2C%22table%22%5D%7D%5D%7D");
I see that google.visualization is available but it doen not contain
obkects like dataview etc. The firefox debugger gives the warning: A
call to document.write() from an asynchronously-loaded external script
was ignored.

Viz Kid

unread,
Mar 26, 2011, 9:59:25 AM3/26/11
to google-visua...@googlegroups.com, Henk

This does not seem related to caching or the different url issue.

When you use the url you specified, it returns the small code block that will, among other things, load the requested modules using:
  google.loader.writeLoadTag("script", google.loader.ServiceBase + "/api/visualization/1.0/48f3f5b4644f1324d4fef0a738c3d446/default,table,corechart.I.js", false);
It seems that for some reason this was blocked on your browser.

  Viz Kid


--

Henk

unread,
Mar 26, 2011, 10:09:43 AM3/26/11
to Google Visualization API
Ah, probably we are talking in different directions...

Yes, the caching from the files is allright know. From a second back
to 1ms :-)

I was referring to the dynamical load of the lib. That was what I
tested and did not work. But you were obviously not referring to
that..

Regards,
Henk

r o g e r

unread,
Mar 31, 2011, 2:30:26 AM3/31/11
to google-visua...@googlegroups.com
It's working perfectly for me now.  Thanks!

Roger

Chintan Shah

unread,
Dec 19, 2011, 11:36:42 AM12/19/11
to google-visua...@googlegroups.com, Henk
Viz,

I'm observing above behavior, where in server sends small code block. If this is the case, then how shall one achieve application-cache on client? 

I'm trying to support a use-case, where in device shall continue to use graph api's even in offline (no network connection) mode. 

Thanks,
Chintan

Viz Kid

unread,
Dec 19, 2011, 12:02:38 PM12/19/11
to google-visua...@googlegroups.com, Henk

The API was not intended to work offline and therefore this was not a real consideration. Regardless, the API can sometimes load additional resources after the chart is already running, depending on the data (for example, the map polygons in map-based visualizations).

Sorry,
  Viz Kid

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
Reply all
Reply to author
Forward
0 new messages