views:

244

answers:

1

I wrote a very small web application that sends your GPS coordinates to a script. If I load the site in Safari on the iPhone, it asks if it can use the GPS coordinates, and if I click yes, it sends the data. If I add a bookmark to the home screen so that it can run more like an application, when the code reaches navigator.geolocation.getCurrentPosition(), I am first asked "'[App Name]' would like to use your current location" and when I click yes to that, right away I am asked "'http://%5Bmyurl]' would like to use your current location" where App Name is the name that I saved the bookmark as, and myurl is the url of the original page that I navigated to in Safari. Why am I being asked this twice?

+2  A: 

There are two levels of permissions going on here. First, the Safari app needs general permission to access your location. Second, the specific website needs permission, as well. Otherwise, once you granted Safari permission, all sites would have access to that data.

ceejayoz
Then why does this only happen when I've saved the site as a bookmark? If I reset all history/cache/location warnings, etc and pull up the site in Safari, it only asks once. Once its saved and launched as a standalone web app, then it asks twice.
Danny Cohn
The standalone app is likely seen as an app just like Safari is. Separate set of permissions.
ceejayoz