Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
8391 Vistas

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
Descartar
Autor Mejor respuesta

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
Descartar
Mejor respuesta

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
Descartar

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 ;)

Publicaciones relacionadas Respuestas Vistas Actividad
6
nov 17
11213
2
mar 15
7430
3
ago 24
13341
0
abr 18
4025
1
ene 24
1187