I am working on an intranet application that uses the Google Visualization API to produce charts.

My question is is there a way to determine if access to https://www.google.com/jsapi server is down or blocked due to the company use of iPrism and display that information simply to the user on the page.

I know iPrism dosn't block it on my machine but i'm not sure about the client machines or that it may change in the future.

Any help is aapreciated.

有帮助吗?

解决方案

I don't think there is anything you can trigger of of a script tag failing to load, but you could try to catch the failure before calling google.load, maybe with something like this?

if (typeof(google) == 'object' && typeof(google.load) == 'function') {
    google.load('visualization', '1', {packages:['corechart'], callback: drawChart});
}
else {
    // display error message about failing to load jsapi
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top