When I turn off Google API I get an "Uncaught TypeError: Cannot read property 'DataTable' of undefined" message.
I would like to catch this undefined error and have a window popping up saying "Google has been disabled" but I'm not sure what typeof is undefined. I'm currently checking "DataTable" type but the window pops up regardless now.
Can someone help me please?
What I have tried:
Here is my code.
var data = new google.visualization.DataTable();
if(typeof DataTable == "undefined"){
window.alert("sometext");
} else {
data.addColumn('string', 'Name');
data.addColumn('string', 'Manager');
data.addColumn('string', 'ToolTip');
data.addColumn('string', 'Type');
data.addColumn('string', 'Code');
data.addColumn('string', 'Aggregation');
data.addColumn('string', 'Stage');
data.addRows([
<xsl:apply-templates select="/*" mode="render"/>
['1','2','3','4','5','6','7']
]);
data.removeRow(data.getNumberOfRows() - 1);
drawDebugFlow(data);
}