In your standard desktop browser like Safari or Chrome, when you navigate to a site such as maps.google.com and click on the ‘my location’ button, a message appears asking you if you’d like to give permission to the website to use your GPS/wifi triangulation position.
My question is, how do you detect such an event and show a dialog to a user when using a standard Cocoa (desktop) WebView object? I’ve tried implementing all of the various delegate methods and none of them seem to catch this javascript event.
navigator.geolocation.getCurrentPosition(function(position) {
do_something(position.coords.latitude, position.coords.longitude);
});
It just fails silently. How do I ask the user for location sharing permission?
Just digging in some private headers I found this method:
Did you try to see if it gets called? You probably won’t get this past the App Store though, since it is a private API call.