国内使用Google Maps JavaScript API
<!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>Simple markers</title> <style> html, body { height: 100%; margin: 0; padding: 0; } #map { height: 100%; } </style> </head> <body> <div id="map"></div> <script> function initMap() { var myLatLng = {lat: -25.363, lng: 131.044}; var map = new google.maps.Map(document.getElementById('map'), { zoom: 4, center: myLatLng }); var marker = new google.maps.Marker({ position: myLatLng, map: map, title: 'Hello World!' }); } </script> <script async defer src="https://maps.googleapis.com/maps/api/js?key=API_KEY&signed_in=true&callback=initMap"></script> </body> </html>
<script src="http://maps.google.cn/maps/api/js?v=3.20®ion=cn&language=zh-CN&key=your_key&callback=initMap"></script>
上面两部分红色字比较重要,一个是在域名,一个是访问google地图的key,这个需要FQ到google官网进行注册,然后复制过来就ok
Get Key Link:
https://developers.google.com/maps/documentation/javascript/?hl=zh-cn