Skip to Content
Menu
This question has been flagged
2 Replies
8379 Views

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
Discard
Author 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
Discard
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
Discard

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 Views Activity
6
Nov 17
11198
2
Mar 15
7430
3
Aug 24
13310
0
Apr 18
4001
1
Jan 24
1153