application to a secure origin
Hello All,
I am facing with message below when running codes below:
getCurrentPosition() and watchPosition() are deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
function setCurrentLocation() {
var geoOptions = {
enableHighAccuracy: true
};
Code: Select all
var geoSuccess = function(position) {
var currentposition = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
localStorage.setItem('_newlat',position.coords.latitude);
localStorage.setItem('_newlng',position.coords.longitude);
ggeocoder.geocode( {'latLng': currentposition}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var address = results[0].formatted_address;
document.getElementById("current_location").value = address;
}
});
gmarker.setPosition(currentposition);
gmarker.setMap(null);
gmarker.setMap(gmap);
gmap.setCenter(currentposition);
gmap.setZoom(17);
};
var geoError = function(error) {
alert('Error occurred. Error code: ' + error.code);
// error.code can be:
// 0: unknown error
// 1: permission denied
// 2: position unavailable (error response from location provider)
// 3: timed out
};
navigator.geolocation.watchPosition(geoSuccess,geoError,geoOptions);
}