Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

325
Visualizações
navigator.geolocation.getCurrentPosition not working on a certain browser

I'm having a problem with javascript's:

navigator.geolocation.getCurrentPosition(success_callback,error_callback)

It's working fine on most machines with most browsers..problem is I have a Mac and by default it prevents browsers accessing locations, unless I manually allow it at the OS level. (As a side note I'm using the Brave browser, chrome doesn't have the issue)

What is happening at the moment is that Brave asks for permission to access location. I select yes but because at the OS level it isn't permitted, the success_callback and the error_callback are both not called...thus my site just hangs there.

I should mention, chrome doesn't have this issue, it somehow knows the os is blocking the permission so the error_callback gets called.

My question is how do I over come this? Partial code is below:

<template>
    <Modal v-if="showModal">
</template>

navigator.geolocation.getCurrentPosition(this.setBrowserLocation, this.errorBrowserLocation)

setBrowserLocation(position) {
    ....
    ....
    ....
    this.showModal = true
}

errorBrowserLocation(error) {
    this.showModal = true
}

I'm thinking that I can do something along the lines of checking if neither one of the call_backs is called. And if they are both not called I can auto set this.showModal. I thought of using watchers but they only detect a change...so nothing changes then I can't really use it.

Any ideas of how I can deal with this?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda