Chrome IOS HTML5 geolocation permission denied
14,366
You have to explicitly allow Mobile Chrome to use Location Services in ios. In ios6 you can achieve this by going to Settings->Privacy->Location Services and toggling Chrome to On.
Author by
chad
Updated on July 20, 2022Comments
-
chad almost 2 years
When trying to use the HTML5 geolocation api on mobile chrome for ios, my app throws a "Permission Denied" error without even prompting to share my location. Has anyone else run into this issue?
PS. This happens locally and on a heroku instance.
Here is the code I am running on document ready
var displayCloseFoo = function(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; }; var displayError = function(error) { var errors = { 1: 'Permission denied', 2: 'Position unavailable', 3: 'Request timeout' }; alert("Error: " + errors[error.code]); }; var runGeo = function(){ if (navigator.geolocation) { var timeoutVal = 10 * 1000 * 1000; navigator.geolocation.getCurrentPosition( displayCloseFoo, displayError, { enableHighAccuracy: true, timeout: timeoutVal, maximumAge: 0 } ); } else { alert("Geolocation is not supported by this browser"); } }; runGeo();
Thanks
-
chad almost 12 yearsThis does not work for mobile chrome on ios. Just opened the fiddle up on my phone and it gives me the same behavior as my code above.
-
mattnull almost 12 yearsweird.. I did the same thing and it worked on my phone... do you have location services turned on? This maybe needs to be enabled
-
mattnull almost 12 yearsSo I noticed that once you deny it once, and then reload.. it will continue to say permission denied... I think this is because it adds an exception into Chrome to deny further access.
-
chad almost 12 yearsinteresting, im pretty sure that I never denied it, but i'll try to look into the chrome exceptions