geolocation.watchPosition API を入れましたが、ブラウザで実行すると地図がまったく表示されません。この問題を解決する方法を教えてください。
<script>
if (navigator.geolocation)
{
function showPositionOnMap(position)
{
var point = new google.maps.LatLng(position.coords.latitude,
position.coords.longitude),
myOptions = {
zoom: 15,
center: point,
mapTypeId: google.maps.MapTypeId.ROADMAP
},
mapDiv = document.getElementById("mapDiv"),
map = new google.maps.Map(mapDiv, myOptions),
marker = new google.maps.Marker({
position: point,
map: map,
title: "You are here"
});
}
var timeoutVal = 10 * 1000 * 1000;
navigator.geolocation.watchPosition(showPositionOnMap, errorMessage,
{
enableHighAccuracy: true, timeout: timeoutVal, maximumAge: 0 });
}
else
{
alert("Geolocation is not supported by this browser");
}
</script>