How to know loadVisualizationApi failed to load chart package.

79 views
Skip to first unread message

Vikas Yadav

unread,
Aug 9, 2012, 8:41:28 AM8/9/12
to google-visua...@googlegroups.com
In some cases (like when no web access available) "loadVisualizationApi" fail to load charts. But how to insurance that it is failed to load package. 
Actually I want to show error label when it fail to load chart package.



ChartMan

unread,
Aug 13, 2012, 2:31:23 AM8/13/12
to google-visua...@googlegroups.com

It never fails for me, do you have network issues?

On Aug 9, 2012 3:41 PM, "Vikas Yadav" <vikas....@gmail.com> wrote:
In some cases (like when no web access available) "loadVisualizationApi" fail to load charts. But how to insurance that it is failed to load package. 
Actually I want to show error label when it fail to load chart package.



--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/lqNpqLxRvpcJ.
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.

Vikas Yadav

unread,
Aug 13, 2012, 5:28:11 AM8/13/12
to google-visua...@googlegroups.com
It fails when no web access available. In that case I want to show error message to the user. 


On Monday, August 13, 2012 12:01:23 PM UTC+5:30, h wrote:

It never fails for me, do you have network issues?

On Aug 9, 2012 3:41 PM, "Vikas Yadav" <vikas....@gmail.com> wrote:
In some cases (like when no web access available) "loadVisualizationApi" fail to load charts. But how to insurance that it is failed to load package. 
Actually I want to show error label when it fail to load chart package.



--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/lqNpqLxRvpcJ.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

ChartMan

unread,
Aug 13, 2012, 4:17:46 PM8/13/12
to google-visua...@googlegroups.com

There are html5 offline APIs, this is not part of charts API.


To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.

asgallant

unread,
Aug 13, 2012, 5:12:30 PM8/13/12
to google-visua...@googlegroups.com
Technically, you can check the onLine property of the Navigator object, but this only works in modern browsers and isn't (yet?) handled consistently across browsers (as the major players can't agree on what it means to be "online").  This might work for you, but I suspect there are problems with it:

<script type='text/javascript' src='http://www.google.com/jsapi?nocache=<?php echo getDate()[0];?>'></script>
<script type='text/javascript'>
if (typeof(google!= 'undefined'{
    google.load('visualization''1'{packages['controls']});
    google.setOnLoadCallback(drawChart);
}
else {
    // throw error message
}
</script> 

Which should prevent the browser from caching the loader API (example uses PHP to add the date in seconds since the Unix epoch as a parameter to the js file - you would have to adjust depending on your server-side scripting).  If there is no connection to Google's servers, then google won't be defined and the error can be thrown.  It doesn't strictly test for internet connectivity, but it does determine whether or not the API is available.  Also, it wastes bandwidth by preventing the API from caching, so it's not a very good solution.
Reply all
Reply to author
Forward
0 new messages