Google Maps API - disabled on domain

前端 未结 4 1801
没有蜡笔的小新
没有蜡笔的小新 2020-12-30 07:25

When page loads i get the message as javascript alert: Google has disabled use of the Maps API for this application. See the Terms of Service for more information: ht

相关标签:
4条回答
  • 2020-12-30 08:03

    I suddenly have this warning in a web app on iPhone Safari only, after everything working fine for months. iPhone Chrome browser works and desktop mac safari and chrome works. Can't see where the terms are being broken

    Strange! Clearing my cache and cookies on iPhone has cleared the problem. Map works fine now. Must be some change in the api which is triggering the problem for users who have recently visited

    0 讨论(0)
  • 2020-12-30 08:08

    For everyone getting this error / alert, you must:

    1.) Ensure that you are linking to the online API, as noted by Steve Feng. Replace your code for accessing the Google API file with this:

    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=SET_TO_TRUE_OR_FALSE">
    

    2.) Make sure you clear your page's cache - even if you were already accessing the file with the code above(like I was). This may be done quickly if you're working on a Windows platform by pressing [ctrl] + [F5], or by pressing [cmd] + [R] on a Mac(or ['apple'] + [R]). On linux a simple [F5] should force refresh. If this button combination didn't work(or doesn't apply to you), look at this website for more information on clearing your cache.

    After you've cleared your cache and made sure your code accesses the API file from the URL posted above, you should not get that message anymore(as far as I have experienced).

    AFAIK, this message appears regardless of you actually breaking Google's Terms and Conditions or not. Furthermore, I have found this message may appear when using a Google API that isn't Google Maps. One example of a complaint here (at bottom).

    I have no straight evidence to believe this, but I think this message became Google's default(-ish) error message when you did something to upset one of their APIs.

    0 讨论(0)
  • 2020-12-30 08:09

    Referencing the Google maps script from you local machine causes this issue.

    Just reference it back to the remote version and add the ?sensor=false to the end and you should be good to go.

    0 讨论(0)
  • 2020-12-30 08:15

    My web application had this same error occur, and we fixed it by updating our link to the Google Maps API file.

    Previously we were using a downloaded version of the Maps API file located at http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=SET_TO_TRUE_OR_FALSE.

    When we instead used the direct link, this particular error went away.

    Edit: Even if you're directly linking to Google's js file, make sure your application isn't using an older locally cached version.

    Not working version:

    <script type="text/javascript" src="local_google_maps_api.js">
    

    Working version:

    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=SET_TO_TRUE_OR_FALSE">
    

    Google likely started invalidating Google API v3 calls using older address versions. The Javascript code files mainly differ in the API IP address call

    0 讨论(0)
提交回复
热议问题