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

165
Vistas
Chrome Extension Geo location Permission

getting error : Is the 'geolocation' permission appropriate? See https://developer.chrome.com/extensions/manifest.html#permissions.

Trying to get user location coordinate for chrome extension app and i am getting permission error although i have given permission in manifest.json still getting error Is the 'geolocation' permission appropriate? See https://developer.chrome.com/extensions/manifest.html#permissions.

my code: index.js

navigator.geolocation.getCurrentPosition (function (position) {
    console.log(position.coords.latitude, position.coords.longitude);
    const lat=position.coords.latitude;
    const lng=position.coords.longitude;
    fetch("https://api.opencagedata.com/geocode/v1/json?key=************&q=" +lat + "+" + lng + "&pretty=1&no_annotations=1").then(res=> res.json()).then(place=>{
    city=(place.results[0].components.city).toUpperCase();
    console.log(city);
    country=((place.results[0].components.country).toUpperCase()).substring(0,2);
    console.log(country)

   
    fetch(url+city+','+country+'&appid='+key).then(data=>data.json()).then(weather=>{
        const wtemp=weather.main;
        const wsys=weather.sys;
        var sunrise=new Date(wsys.sunrise*1000).toLocaleTimeString();
       weatherWidgetRow1=document.getElementById('weatherWidgetRow1');
       weatherWidgetRow1.innerHTML=`${city}<br>`+((wtemp.temp-273).toFixed(0))+`<sup>o </sup>C`;
       
       weatherWidgetRow2=document.getElementById('weatherWidgetRow2');
       weatherWidgetRow2.innerHTML='min : '+((wtemp.temp_min-273).toFixed(0))+`<sup>o</sup> C`+` and max : ${(wtemp.temp_max-273).toFixed(0)}<sup>o</sup> C`;
    
       weatherWidgetRow3=document.getElementById('weatherWidgetRow3');
       weatherWidgetRow3.innerHTML=`Humidity: ${wtemp.humidity} %`;
    
       weatherWidgetRow4=document.getElementById('weatherWidgetRow4');
       weatherWidgetRow4.innerHTML=`Sunrise : ${sunrise} <br>  Sunset : ${new Date(wsys.sunset*1000).toLocaleTimeString()} `;
    
    });

});
}, console.error(),
{ maximumAge: 600_000 }
);

manifest.json

{
    "name": "WeatherExtension",
    "version": "0.0.1",
    "manifest_version": 2,
    "browser_action":{
        "default_popup": "index.html",
        "defaul_icon": "logo.png"
    },
    "icons":{
        "128": "logo.png"
    },
    "permissions" : ["geolocation"] 
}

where i am wrong ?

about 4 years ago · Juan Pablo Isaza
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