Peter Bennett
Peter Bennett

Reputation: 11

Referer Not Allowed Map Error

I have a file in my pc named "GMPos.html", the file contains 1 marker:

 <script src='https://maps.googleapis.com/maps/api/js?v=3.4&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'></script>
<script type="text/javascript">

var icon_shadow = new google.maps.MarkerImage('icons/mm_20_shadow.png',
new google.maps.Size(28,22),
new google.maps.Point(0,0),
new google.maps.Point(10,21));
var a_icon = new google.maps.MarkerImage('icons/mm_20_red.png',
new google.maps.Size(22,22),
new google.maps.Point(0,0));
var map;

function loadMap() {
var myLatLng = new google.maps.LatLng(14.60192,-90.53268);
var myOptions = {
center: myLatLng,
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
var marker = new google.maps.Marker({
position: myLatLng,
icon: a_icon,
shadow: icon_shadow,
map: map,
title:'Id: GUA001'
});
}

</script>

When I try to open the file in Firefox, I got the following error:

"Google Maps API error: 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: file:///C:/RunTime/Mss/GMH/GMPos.html"

So, I have added the following referres:

*C:/RunTime/Mss*
file:///C:/RunTime/Mss/GMH/GMPos.html
*file:///C:/RunTime/Mss/GMH/GMPos.html*

But still throws the same error, please help.

Thank you in advance

Upvotes: 1

Views: 1418

Answers (1)

Vaiden
Vaiden

Reputation: 16122

Please check your API quota restrictions connected to your key in the Google API Console. The marker API is considered a "Maps JavaScript API" restriction.

Upvotes: 3

Related Questions