Using the standard HTML5 geolocation code, I am able to access the geolocation on desktop browsers (Chrome, Firefox), but not on my Samsung Galaxy S3 (default browser, Chrome). In the default browser, nothing at all happens. In Chrome, the yellow permissions form pops up at the bottom but then pops down too quickly to press anything. I have checked that Location is enabled in Settings. I am considering looking for a PHP solution as a backup for cases when JavaScript/HTML5 solution breaks down like this, but would prefer that the JavaScript solution be more robust.
Has anyone come across this and fixed it? Any ideas?
For reference, the "standard" HTML5 geolocation code I'm referring to is this (sample code from: Basic Geolocation in HTML5):
<script type="text/javascript">
if( navigator.geolocation )
{
// Call getCurrentPosition with success and failure callbacks
navigator.geolocation.getCurrentPosition( success, fail );
}
else
{
alert("Sorry, your browser does not support geolocation services.");
}
function success(position)
{
// GeoPosition Object
alert("Your coordinates are " + position.latitude + ", " + position.longitude);
}
function fail()
{
// Could not obtain location
}
</script>
Odd. I did 3 things and now it works in both phone browsers (default and chrome)
<body onload="">
I suspect the restart did the most for it, since I was seeing the permission pop up flash across the screen in chrome.