Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!