0

Suppose my site is www.example.com, I have a page map.php in which i want to access places api. I have added all the credentials and also the HTTP referrer as example.com/map.php. enter image description here enter image description here But its still giving me Referrer Not Allowed error.

<script src="https://maps.googleapis.com/maps/api/js?key=****&libraries=places"></script>
        <script type="text/javascript">
            function initialize() {
                var options = {
                    componentRestrictions: {country: "in"}
                };
                var input = document.getElementById('txtcity');
                new google.maps.places.Autocomplete(input, options);
            }
            google.maps.event.addDomListener(window, 'load', initialize);

        </script>
user3099225
  • 413
  • 1
  • 4
  • 14

1 Answers1

0

Try to add all type of urls like:

.example.com/

http://example.com/*

http://www.example.com/*

Then it'll definitely work

Rushikesh Pandit
  • 665
  • 5
  • 11
  • i have fixed the problem by creating a new key. but now i got a new problem. just after one place search its giving me error - **You have exceeded your daily request quota for this API. If you did not set a custom daily request quota, verify your project has an active billing account: http://g.co/dev/maps-no-account For more information on usage limits and the Google Maps JavaScript API services please see: https://developers.google.com/maps/documentation/javascript/usage** – user3099225 Sep 20 '18 at 11:35
  • You got this error because Google has been stopped to providing free quota without enabling billing. But still Google provide the free $200 quota monthly, If you want to use it then first you need to enable the billing and then you can use 2,500 free ***place API*** request. – Rushikesh Pandit Sep 23 '18 at 14:59