So I'm currently trying to get a map on my webpage, and have the correct code in the editor, however where I src my google and plug in my API key the ampersand after my key is red. I don't know if this is causing the problem or not, but the map isn't showing up.
Any thoughts on why this might be?
<div id="map">
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDvTry6RgHatGai_J7kt66sA5chXzhkghY&callback=initMap">
</script>
</div>
Your context is HTML, so to represent an ampersand , use &
.
Currently you are attempting to denote entity &callback=initmap
what is invalid one, therefore the ampersand is red.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.