Here is my very simple code:
if (navigator.geolocation) { // WILL GET TO THIS POINT WITH TEST `ALERT()` navigator.geolocation.getCurrentPosition( // WILL NOT GET OT THIS POINT IN ANDROID BROWSER function(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; }, showError, { enableHighAccuracy: true, timeout : 5000, maximumAge: 0 } ); } else { return alert('No Geolocation Support.'); } };
It works great on iOS (Safari and Chrome); and all the PC browsers I tried.
On Android, I tried using the HTC Chrome, Chrome, and Dolphin browser. Satellites look like they are looking then they are stopping. I donβt even remember asking for my permission to use geolocation (could have missed this part)
UPDATE It works in my Chrome Nexus 10 browser. But not my HTC One X.
UPDATE 2 . It looks like ONLY on one Android device, AT & T HTC One X. All other Android devices, browsers for PC and iOS are working fine. In One X, I get the error code: Timeout. In addition, GPS is working fine on this device otherwise.
source share