We are including the Google Maps API V3 in our internal systems with the below code:
script src="https://maps.googleapis.com/maps/api/js?key=&libraries=places,geometry"
This was working until a few hours ago (9am AEST) now in the console all that's returned is:
Uncaught TypeError: b.has is not a function from https://maps.googleapis.com/maps-api-v3/api/js/35/3/map.js
Is anyone else facing the same problem?
How can I fix it when the code is included from Google's servers?
Had the same problem, using an older version fixed it for now:
https://maps.googleapis.com/maps/api/js?v=quarterly&key=API_KEY
Long time fix - You probably overwrote the native window.Map, see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Map
We have the same problem here. We had a link to the last version : https://maps.googleapis.com/maps/api/js?key=...
If we force the version to 3.34 it does the trick : https://maps.googleapis.com/maps/api/js?v=3.34&key=
Version 3.35 is not working. Google has replaced a function used with maps (hashmaps, not graphic maps) which is used to search for a key. hasOwnProperty(b, c) --> b.has(c)
Problem is that "b" does not have the function "has".
I do not have much more information at this point. We are continuing the investigation.
Good luck everyone.
Regards Vincent
Edit : OK, now I do understand what happened. Somewhere in our map, we are re-defining the prototype "Map". This protoype does not contain the method "has" and maybe "set" too (that was the case for us). You have to search for something like "Map.prototype." in jour JS files. This will give you the hint for where you have to correct your JS. If you can't suppress this prototype, you will have to redefine the missing methods. For example, we had the following prototype :
function Map(){
this.obj = {};
this.count = 0;
}
We had to complete this prototype with the following methods :
Map.prototype.has=function(key){
return this.obj[key] !== undefined;
}
Map.prototype.set = function(key, value){
var oldValue = this.obj[key];
if(oldValue == undefined){
this.count++;
}
this.obj[key] = value;
return oldValue;
}
With this correction, version 3.35 of GoogleMaps JS is working.
I hope it helps.
Regards, Vincent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With