I call my HTML with googlemaps from another application by window.open (javascript). The html page open, but dont works (any action fails), i just can see the map. After i do CTRL + f5 works... I need this working in the first call... someone can help me?
html:
<html>
<body>
<h1>Prisma3 x Google Maps</h1>
<div id="googleMap" style="width:100%;height:400px;"></div>
<script>
function myMap() {
var map = new google.maps.Map(document.getElementById('googleMap'), {
zoom: 3,
center: {lat: 0, lng: -180},
mapTypeId: 'terrain'
});
var flightPlanCoordinates = [
{lat: 37.772, lng: -122.214},
{lat: 21.291, lng: -157.821},
{lat: -18.142, lng: 178.431},
{lat: -27.467, lng: 153.027}
];
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
flightPath.setMap(map);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?
key=AIzaSyC7vePTtjVs90u3kKlOMYP-UtyISm9F56M&callback=myMap"></script>
</body>
</html>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…