Skip to Content
Menu
This question has been flagged
2 Replies
8504 Zobrazenia

When inserting the Google Maps API, I get the following error:

Malformed XML document: This page contains the following errors:error on line 39 at column 43: Specification mandate value for attribute async Below is a rendering of the page up to the first error.


Any help? I removed async but still receive errors. I am assuming I need to insert the code elsewhere and refer to it. Below is the culprit:

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

Avatar
Zrušiť
Autor Best Answer

I had to use a different method of adding the map.


<script src="http://maps.googleapis.com/maps/api/js?key=YOUR-KEY-HERE"></script>
<script> function initialize() { var location = new google.maps.LatLng(53.564869,9.926917); var mapProp = { center:location, zoom:14, mapTypeId:google.maps.MapTypeId.ROADMAP }; var map=new google.maps.Map(document.getElementById("googleMap"),mapProp); var marker = new google.maps.Marker({ position: location, map:map }); marker.setMap(map); }; google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="CSS-MAP-DIV" style="width:100%;height:500px;"></div>

Avatar
Zrušiť
Best Answer

it need to be xml, so all attributes require a value...


<script async="async" defer="defer" src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"> </script>
Avatar
Zrušiť

Meanwhile, in v15 you can now just use 'head/footer code' (common on all page) or html block (on a specific page) to past this kind of script ;)

Related Posts Replies Zobrazenia Aktivita
6
nov 17
11295
2
mar 15
7430
3
aug 24
13496
0
apr 18
4104
1
jan 24
1285