Hello I made a web app that shows the current location, the final destination and some waypoints in between that the user needs to visit. Since some days google changed something about its privacy? And now it doesn't load my map anymore. The only error I get is
getCurrentPosition()
andwatchPosition()
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 Deprecating Powerful Features on Insecure Origins for more details.
I followed the link but I don't get any wiser of it. The fiddle of my code is here:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
curLoc = new google.maps.LatLng(
position.coords.latitude,
position.coords.longitude
);
var request = {
origin: curLoc,
destination: fabriek,
travelMode: google.maps.TravelMode.DRIVING,
waypoints: waypts,
optimizeWaypoints: true
};
var infowindow = new google.maps.InfoWindow({
content: "Dit ben jij"
});
var bestuurderIcon = new google.maps.MarkerImage('marker-bestuurder.png',
null,
null,
null,
new google.maps.Size(40, 50));
var marker = new google.maps.Marker({
position: curLoc,
icon: bestuurderIcon,
map: map,
title: 'Dit ben jij',
animation: google.maps.Animation.DROP
});
marker.addListener('click', function() {
infowindow.open(map, marker);
});
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
// navigeer naar volgende punt met google applicatie op device
document.getElementById("gohere").href = "google.navigation:q=" + response.routes[0].legs[0].end_address;
}
});
});
}
The warning(it's not an error) means.
In the future(not now) it will not be possible to use getCurrentPosition
in conjunction with insecure connections.
In the linked fiddle you shouldn't see this warning, because it's secure
https://jsfiddle.net/pquumq74/
but you should see the message at
(Note the difference between the protocols, when you use the first link and retrieve the page-details you'll see that the connection is encrypted...secure)
When you get an error PERMISSION_DENIED(I wonder where, you didn't define a failure-callback) it simply means that the browser/user didn't grant access to geolocation, this is not related to the warning about about the insecure connection.