Does anyone know a way to test via Javascript or a HTTP-Request, if the quota of Google Maps Javascript API V3 is reached? Getting the error-message, which is displayed for
I came up with a solution based on the observation that the Google error message contains an element with the dismissButton class attribute. With jQuery, it is something like
var quota_exceeded = false;
$(document).ready( function() {
setTimeout(check_quota, 1000);
setTimeout(check_quota, 3000);
setTimeout(check_quota, 10000);
});
function check_quota() {
if (quota_exceeded) return;
if (typeof($("button.dismissButton")[0]) === "undefined") return;
quota_exceeded = true;
// you can even hijack the box and add to Google's message
$("button.dismissButton").parents("td").html(
"We have exceeded our quota!!!!!" +
"
" +
"
");
$("button.dismissButton").click( function() {
$("button.dismissButton").parentsUntil("div").parent().hide();
});
}