Google Maps API JavaScript error when GBrowserIsCompatible() is called -
i error on following line:
if (gbrowseriscompatible()) {
this code still not working
<script src="http://maps.google.com/maps?file=api&v=2.x&key=<?php echo $google_api['value'];?>" type="text/javascript"></script> <script type="text/javascript"> var map = null; var geocoder = null; function initialize(address) { if (gbrowseriscompatible()) { map = new gmap2(document.getelementbyid("map_canvas")); map.setcenter(new glatlng(37.4419, -122.1419), 13); geocoder = new gclientgeocoder(); /* start */ if (geocoder) { geocoder.getlatlng( address, function (point) { if (!point) { alert(address + " not found"); } else { map.setcenter(point, 13); var marker = new gmarker(point); map.addoverlay(marker); marker.openinfowindowhtml(address); } } ); } /* end */ } } </script>
did load google maps api your own api key?
<script src='http://maps.google.com/maps?file=api&v=2&key=enter_api_key_here'></script>
source: http://code.google.com/p/jmaps/issues/detail?id=12
update
check out troubleshooting page ie.
maybe you're checking early. try this:
var iterations = 0; function check_compat() { if (iterations === 75) { alert('failed load google maps api. clear browser cache, open google maps try again.'); return; } if (typeof gbrowseriscompatible === 'undefined') { // isn't loaded, schedule next check. settimeout(check_compat, 200); iterations++; } else { if (gbrowseriscompatible()) { mapreadyfn(); } else { alert('sorry, browser not supported.'); } } }
after that, replace line:
if (gbrowseriscompatible()) {
with this:
function mapreadyfn() {
if fails 15 seconds, stops trying , error.
Comments
Post a Comment