Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

137
Vistas
navigator.geolocation.watchPosition() doesn't log position when phone display is off

Say I have a website with this code:

<script>
const watchID = navigator.geolocation.watchPosition((position) => {
    el = document.querySelector('#log');
    el.innerHTML = el.innerHTML + position.coords.latitude + ',' + position.coords.longitude + '<br>';
});
</script>

<div id="log"></div>

The code runs without issue, on my phone, when the display is on and I'm currently viewing the page in the browser. But if I turn the screen off or go to another app (whilst not closing the browser) I code stops running. It's like it only runs when it has focus.

Am I correct in assuming that this is the key difference between a mobile app and a webpage?

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda