I am using Ubuntu 14.04. I am facing an issue with google maps geo-location. I wrote a piece of code which shows geo-location map in my project, initially it worked fine. But I am facing an issue with this now. Even the link https://developers.google.com/maps/documentation/javascript/examples/map-geolocation is always throwing an error. In windows it works fine but not in Ubuntu. I tried in various computers running on Ubuntu, I got same error. Can anyone help me?
Thanks in advance.
Here is my script code:
if(navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(success, displayError, options);
}
var options = {
enableHighAccuracy: true,
timeout: 30000,
maximumAge: 0
};
// SUCCESS(POSITION) FUCNTION FOR SHOWING CURRENT LOCATION OF THE USER
function success(position) {
if(navigator.geolocation){
var myLatLng={lat:position.coords.latitude , lng:position.coords.longitude}
var map = new google.maps.Map(document.getElementById('googleMap'),
{
center:myLatLng ,
zoom: 8
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
});
}
}
// IN THIS FUNCTION WE HAVE SET STANDARD LAT LNG FOR STANDARD MAP(IF GPS NOT AVAIALABLE)
function displayError(err) {
map = new google.maps.Map(document.getElementById('googleMap'), {
center: {lat: 28.644800, lng: 77.216721},
zoom: 8
});
};
Here is my html code:
<script src="
https://maps.googleapis.com/maps/api/js?key=mykey"></script>
<div id="googleMap"></div>