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.

On Monday, August 13, 2012 5:28:11 AM UTC-4, Vikas Yadav wrote:
>
> 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" <[email protected]> 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 [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-visualization-api?hl=en.
>>>
>>

-- 
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/-/JZFBWqtBpKoJ.
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-visualization-api?hl=en.

Reply via email to