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

300
Views
The website is asking for a permission to access location, whereas the location access is in client side

Let us consider this javascript code:

if (navigator.geolocation){
  navigator.geolocation.getCurrentPosition(function(position) {
    document.getElementById('id111').innerHTML="latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude;
  });
}

It first checks if the navigator.geolocation object is available, and if so, and write the user's coordinates in the HTML element with the id equal to id111.

And in order to do that, the website that contains this code will ask the user for permission to access his own location.

enter image description here

The question is, why the user's permission is needed here, whereas the code is client-side so the website will not actually access the user's location but it is just printed on the user browser?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The code might be running client side, but it provided by whatever website the user happens to be visiting.

Once that code has the location there is nothing stopping it from, for example, making an Ajax request to send it to a server.

about 4 years ago · Juan Pablo Isaza Report

0

The question is, why the user's permission is needed here

Because you're asking for private information. Some users may not want you to know their physical location, and may choose not to share it. The browser geolocation API standards enforce this.

the website will not actually access the user's location

Sure it will. That's exactly what it's asking for permission to do. Even though your code is running in the user's browser, it's still your code and the user can choose what your code is or is not allowed to access on their computer/device.

but it is just printed on the user browser

The browser doesn't know or care if that's the case. The browser isn't concerned with what you do with the user's private information, only that you get the user's permission before accessing that private information. You can display it on the screen, send it to the server, etc. But first you need the user's permission.

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