javascript - Google Maps are not showing with domainname.com -
javascript:
<script async defer src="https://maps.googleapis.com/maps/api/js?key=mykey"type="text/javascript"></script>
javascript function:
<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 not successful following reason: " + status); } }); } } </script>
i reads following questions problem not solved.
google maps javascript api referernotallowedmaperror
google maps api referrer not allowed
google maps api error: google maps api error: referernotallowedmaperror
the problem , when open website this.
http://mysiste.com/contactus
it not showing map , showing following error.
google maps api error: referernotallowedmaperror https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error site url authorized: http://comprettainsurance.com/contactus"
while if open site this.
http://www.mysiste.com/contactus
the maps working perfectly.
my credential page add domain this.
so why not showing maps without www
?
*.comprettainsurance.com/*
not match http://comprettainsurance.com/contactus
(it matches subdomain of comprettainsurance.com, not domain itself).
you need add additional referrer line:
comprettainsurance.com/*
Comments
Post a Comment