Reputation: 408
If I use geolocation in Mozilla Firefox and set timeout less then ca 7 seconds (update - ca 4 seconds in FF 47.0.1), it returns both success and error (3 - Position acquisition timed out). If no timeout is set or is set long enough, it works OK (returns success). Tested in Mozilla Firefox 47.0 on Windows 7 and Android. See this example.
<h1>Geolocation test</h1>
<div id="results"></div>
<script>
document.getElementById("results").innerHTML = "Let's begin<br>";
navigator.geolocation.getCurrentPosition(positionIs, positionIsNot, {
enableHighAccuracy : false,
maximumAge: 0,
timeout: 4000
});
function positionIs(position) {
document.getElementById("results").innerHTML += "SUCESS: " + position.coords.latitude + "; " + position.coords.longitude + "; " + position.coords.altitude + "<br>";
}
function positionIsNot(err) {
document.getElementById("results").innerHTML += "ERROR: " + err.code + " " + err.message + "<br>";
}
</script>
There is no problem in other browsers. Do I something wrong or is it bug?
Upvotes: 3
Views: 1926
Reputation: 408
This is a bug in the version 47+, see https://bugzilla.mozilla.org/show_bug.cgi?id=1283563
Upvotes: 4