Sorry for the multiple messages! One last thing... The code on your test page has both an initMap reference in the Maps API script tag and an event listener for the 'load' event that references init_map.
If you're loading the Maps API asynchronously you should use only a function reference in the Maps API script tag. But why do you need to use the asynchronous loading at all? There's no benefit to it the way you're using it. You could just load the Maps API synchronously and make things a little simpler. On Mon, Jul 18, 2016 at 5:06 PM, Michael Geary <m...@ok.mg> wrote: > Also, the version on your test page uses initMap in one place and init_map > in another. Anyway, get familiar with the developer tools and you will be > able to track these things down on your own. Happy hacking! > > On Mon, Jul 18, 2016 at 5:04 PM, Michael Geary <m...@ok.mg> wrote: > >> The HTML and JavaScript on your test site is very different from the code >> you listed. The script tags are in a different order, and there are spaces >> in the Maps API script URL. >> >> If you use the actual code you listed in your message it should work. >> >> But more important than that is to learn how to debug JavaScript code so >> it won't be a mystery. >> >> Open the JavaScript console and look at the errors it shows. If you're >> not familiar with the browser developer tools, it's time to learn them. For >> Chrome, start here <https://developer.chrome.com/devtools>. Every >> browser has similar tools. >> >> -Mike >> >> On Mon, Jul 18, 2016 at 2:53 AM, <suean...@caramail.com> wrote: >> >>> Hi I just tried out google maps on my website >>> http://www.frenchhouse.website/gmap.html >>> But it wont work. >>> This is the simple map sample with my api. >>> <html> >>> <head> >>> <style> >>> #map { >>> width: 100%; >>> height: 400px; >>> } >>> </style> >>> </head> >>> <body> >>> <h3>My Google Maps Demo</h3> >>> <div id="map"></div> >>> <script> >>> function initMap() { >>> var mapDiv = document.getElementById('map'); >>> var map = new google.maps.Map(mapDiv, { >>> center: {lat: 44.540, lng: -78.546}, >>> zoom: 8 >>> }); >>> } >>> </script> >>> <script async defer src=" >>> https://maps.googleapis.com/maps/api/js?key= >>> AIzaSyAwRsfs4UeGT5iBr7yvffQ3SAcO6tLuBjk&callback=initMap"> >>> </script> >>> </body> >>> </html> >>> Any help welcome thanks >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Google Maps JavaScript API v3" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to google-maps-js-api-v3+unsubscr...@googlegroups.com. >>> To post to this group, send email to >>> google-maps-js-api-v3@googlegroups.com. >>> Visit this group at >>> https://groups.google.com/group/google-maps-js-api-v3. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-api-v3+unsubscr...@googlegroups.com. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. Visit this group at https://groups.google.com/group/google-maps-js-api-v3. For more options, visit https://groups.google.com/d/optout.