的JavaScript:谷歌地圖不與domainname.com顯示
<script async defer src="https://maps.googleapis.com/maps/api/js?key=mykey"type="text/javascript"></script>
JavaScript函數:
<script type="text/javascript">
var geocoder;
var map;
var latlng;
function codeAddress(address) {
geocoder = new google.maps.Geocoder();
if (geocoder) {
geocoder.geocode({ 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
latlng=results[0].geometry.location;
latlng = new google.maps.LatLng(latlng);
var myOptions = {
zoom: 13,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}
</script>
我讀下面的問題,但我的問題沒有得到解決。
Google Maps JavaScript API RefererNotAllowedMapError
Google maps API referrer not allowed
Google Maps API error: Google Maps API error: RefererNotAllowedMapError
的問題是,當我打開我的網站,像這樣的。
http://mysiste.com/contactus
它沒有顯示地圖和表示跟隨誤差。
Google Maps API error: RefererNotAllowedMapError https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error Your site URL to be authorized: http://comprettainsurance.com/contactus "
而如果我打開我的網站是這樣的。
http://www.mysiste.com/contactus
地圖工作完美。
My Credential Page我在這裏添加域名。
那麼,爲什麼它沒有顯示不www
地圖?
我應該在列表中添加這個推薦人。 '* .comprettainsurance.com/contactus *'? –
如果你想'www.comprettainsurance.com/contactus'工作,你也需要一個。 – geocodezip
它不是通用的我的意思是我只是添加一行,並應在網站的所有頁面上工作? –