I am inserting latitude and longitude values into a database table, but some browser giving big values with decimal and some are giving less below is the values. And some Firefox version GEO map is not coming and some buddy told that add {timeout: 5000}, if browser will not support means will give alert. But not getting to add that value in my Java Script function.
Latitude Longitude
1. 17.442816099999998 78.4800497 // this values are coming from firefox
2. 17.4428978 78.4799792 // this values are coming from google crome
The above Firefox values are correct and that is my exact location. I need Latitude values should come full after decimal 15 digits should come like above number 1 values in google chrome.
Below is my javascript code:
<script type="text/javascript">
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success );
}
else
{
alert("Geo Location is not supported on your current browser!");
}
function success(position) {
var lat = position.coords.latitude;
var long = position.coords.longitude;
var city = position.coords.locality;
var myLatlng = new google.maps.LatLng(lat, long);
var myOptions = {
center: myLatlng,
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
title: "lat: " + lat + " long: " + long
});
marker.setMap(map);
var infowindow = new google.maps.InfoWindow({ content: "<b>User Address</b><br/> Latitude:" + lat + "<br /> Longitude:" + long + "" });
document.getElementById("<%= latt.ClientID %>").value = position.coords.latitude;
document.getElementById("<%= lng.ClientID %>").value = position.coords.longitude;
var div = document.getElementById('map_canvas');
div.style.visibility = 'hidden';
infowindow.open(map, marker);
}