Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
JavaScript by Example

You're reading from   JavaScript by Example Learn modern web development with real-world applications

Arrow left icon
Product type Paperback
Published in Aug 2017
Publisher Packt
ISBN-13 9781788293969
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dani Akash S Dani Akash S
Author Profile Icon Dani Akash S
Dani Akash S
Arrow right icon
View More author details
Toc

Adding Google Maps to the web page

Open the about.html file in VSCode or your text editor. It will have two paragraph <p> tags, in which you can add some information regarding your event. After that, there will be a <div> element with the ID #map, which is supposed to show the location of your event in a map.

I have asked you to generate an API key to use Google Maps before. If you haven't generated it, please get one from: https://developers.google.com/maps/documentation/javascript/get-api-key and add it to your .env file's GMAP_KEY variable. According to the Google Maps documentation, to add a Map with a marker to your web page, you must include the following script on the page:

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

Here, the async and defer attributes of the <script> tag...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime