Google 地图在某些设备上可见,在其他设备上显示错误

Google Maps visible on some devices, error on others

我的 google 地图有问题 here

它可以在我的电脑上看到,也可以在其他浏览器、私人会话和其他设备上看到。 不幸的是,我的客户、网站所有者和其他一些设备看不到它。 控制台显示

Google Maps API warning: NoApiKeys

You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

这是我的:

<div id="map" style="width:100%; height:450px;"></div>
                    <script>
                    function initMap() {
                        var myLatLng = {lat: 50.8394968, lng: 4.2694918};

                        var map = new google.maps.Map(document.getElementById('map'), {
                            zoom: 16,
                            center: myLatLng
                        });

                        var marker = new google.maps.Marker({
                            position: myLatLng,
                            map: map,
                            title: 'Hello World!'
                        });
                        marker.setMap(map);

                        var infowindow = new google.maps.InfoWindow({
                            content:"<p style='text-align:center;'>Wellness All-In <br>"+
                            "Broekstraat 56 – 1700 Dilbeek<br>"+
                            "0496/44.55.56<br>"+
                            "aline@wellnessallin.be</p>"
                        });

                        google.maps.event.addListener(marker, 'click', function() {
                            infowindow.open(map,marker);
                        });
                    }
                    </script>
                    <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA5RLhWKFn4P2XVc8G_yho1oun7xS1RtfU&callback=initMap"></script>

                </div>

有人知道如何解决这个问题吗?

您已包含两次 Google 地图。用钥匙一次

<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA5RLhWKFn4P2XVc8G_yho1oun7xS1RtfU&callback=initMap"></script>

一次没有

<script src="http://maps.googleapis.com/maps/api/js"></script>

删除第二个包含语句。

您的站点还显示以下错误:

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: http://www.wellnessallin.be/contact.php

确保您的网站已添加到 Google API 控制台中指定密钥的允许引荐来源列表。