I have a web page that uses HTML5 geolocation over HTTPS. It works a-okay on desktop browsers. On iOS Safari, however, I get the error that "Origin does not have permission to use Geolocation service". I have ensured that everything on the page loads via HTTPS -- every image, every script, and all other assets are showing HTTPS in Chrome dev tools. Nonetheless, geolocation returns the error.
Here's some of my JavaScript:
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(function (position) {
// Do stuff with the geo data...
}, function(error) {
// I always end up here on iOS Safari.
alert(error.code + ": " + error.message);
});
}
else {
$("#search-results").append("Location is unavailable in this browser.");
}
What have I missed?
More info: I just grabbed the code from this W3 Schools example, which works perfectly in my iOS Safari, and pasted it on my site. It did not work. I still receive no prompt to allow geolocation on my site. I've cleared browser cache and reset location warnings in Settings to no avail.