This page didn't load Google Maps correctly. See the JavaScript console for technical details - Stack Overflow

Oops! Something went wrong. This page didn't load Google Maps correctly. See the JavaScript consol

Oops! Something went wrong. This page didn't load Google Maps correctly. See the JavaScript console for technical details.

i don't know why .

<!DOCTYPE html>
<html>
<head>
    <script src="">
    </script>

    <script>
        var myCenter = new google.maps.LatLng(30.023354, 31.477439);

        function initialize() {
            var mapProp = {
                center: myCenter,
                zoom: 15,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };

            var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);

            var marker = new google.maps.Marker({
                position: myCenter,
            });

            marker.setMap(map);
        }

        google.maps.event.addDomListener(window, 'load', initialize);
    </script>
</head>

<body>
    <div id="googleMap" style="width:500px;height:380px;"></div>

    
</body>
</html>

Oops! Something went wrong. This page didn't load Google Maps correctly. See the JavaScript console for technical details.

i don't know why .

<!DOCTYPE html>
<html>
<head>
    <script src="http://maps.googleapis./maps/api/js">
    </script>

    <script>
        var myCenter = new google.maps.LatLng(30.023354, 31.477439);

        function initialize() {
            var mapProp = {
                center: myCenter,
                zoom: 15,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };

            var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);

            var marker = new google.maps.Marker({
                position: myCenter,
            });

            marker.setMap(map);
        }

        google.maps.event.addDomListener(window, 'load', initialize);
    </script>
</head>

<body>
    <div id="googleMap" style="width:500px;height:380px;"></div>

    
</body>
</html>

Share Improve this question asked Aug 16, 2016 at 10:07 hashimhashim 691 silver badge14 bronze badges 3
  • So... "something" went wrong, what's "something"? what's the expected behaviour, what's actually happening, what does your console say? – Jeremy Thille Commented Aug 16, 2016 at 10:12
  • Did you see the JavaScript console for technical details? – JJJ Commented Aug 16, 2016 at 10:13
  • Possible duplicate of ERROR: Google Maps API error: MissingKeyMapError – Joyson Commented Aug 16, 2016 at 11:17
Add a ment  | 

2 Answers 2

Reset to default 4

You need generate special api key for google maps

your <script src="http://maps.googleapis./maps/api/js"> should looks like this

  <script src="https://maps.googleapis./maps/api/js?key=your_key">></script

Go to https://console.developers.google. to get a free key.

Here’s how to fix the error.

Go to https://console.developers.google./apis/credentials Click your API key’s name to edit its settings. Under Application restrictions, choose “HTTP referrers (web sites)” then add the two entries below (replacing yourname. with your own domain).

Type the first entry then hit enter on your keyboard to add it. Repeat to add the second entry.

Having both entries (with asterisks) will help ensure your maps work on any URL of your website. yourname./* *.yourname./*Google Maps API Restrictions

Click the Save button then wait a few minutes for the change to take effect (Google says it can take up to 5 minutes).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745142946a4613512.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信