Questions tagged [w3c-geolocation]

The W3C Geolocation API provides scripted access to geographical location information associated with a hosting device.

See also:

123 questions
76
votes
5 answers

Is there a way to check if geolocation has been DECLINED with Javascript?

I need JavaScript to display a manual entry if geolocation is declined. What I have tried: Modernizr.geolocation navigator.geolocation Neither describes if user has previously declined access to geolocation.
craigmoliver
  • 6,282
  • 12
  • 48
  • 87
21
votes
8 answers

navigator.geolocation.getCurrentPosition() never returns in WebView on Android

I am trying to access the HTML Geolocation API available in Android WebView (using SDK version 24). The main problem is that the call to navigator.geolocation.getCurrentPosition() in JavaScript never returns (neither with an error, nor with position…
Alexander Galkin
  • 10,800
  • 9
  • 56
  • 111
19
votes
4 answers

How can I use HTML5 geolocation in C# application

I'm developing an anti-theft software to get computers exact location. Notebooks with built-in gps are very rare in my country so I have to use HTML5 Geolocation in my application. For Internet Explorer 9+, there is a registry key that you can add…
Batuhan
  • 270
  • 3
  • 16
17
votes
3 answers

Is there a way of detecting whether a user has already given permission to use navigator.geolocation?

Apart from setting a cookie the first time round, is there a way of detecting whether a user has already given permission for navigator.geolocation to return the lat/long of the browser? If there is, what is it and is it the same across all…
bugmagnet
  • 7,233
  • 7
  • 57
  • 121
16
votes
5 answers

Check if Geolocation was allowed and get Lat Lon

I'm building a small script that clients will install on their page. Geolocation is not necessary for it, however if it exists it would be nice to have. Is there a way for me to check if the clients page has requested geolocation information and if…
Stefan
  • 2,643
  • 1
  • 18
  • 34
15
votes
3 answers

Geolocation API in Safari 8 and 7.1 keeps asking permission

I've built the Geolocation API into my webapp and all browsers are working fine. Except Safari 8 and 7.1. The browser keeps asking for permission after allowing or not allowing it and ends up in an infinite loop making the browser (tab) unusable.…
Gregory Bolkenstijn
  • 9,055
  • 7
  • 33
  • 38
11
votes
2 answers

Is there any alternative to navigator.permissions.query Permissions API?

Is there any alternative to navigator.permissions.query Permissions API query to check geolocation permission. cause its still in Working Draft and has less Browser compatibility. W3C Permissions Ref : https://www.w3.org/TR/permissions/ Issue is app…
10
votes
1 answer

navigator.geolocation.watchPosition just not working

Okay, my code is below so I'll explain what I'm doing and what I'm getting for results. I'm trying to grab the users location using navigator.geolocation.watchPosition. I've specified both a success and error callback. The first time I get the…
jasonaburton
  • 2,321
  • 7
  • 28
  • 47
10
votes
3 answers

Chrome IOS HTML5 geolocation permission denied

When trying to use the HTML5 geolocation api on mobile chrome for ios, my app throws a "Permission Denied" error without even prompting to share my location. Has anyone else run into this issue? PS. This happens locally and on a heroku…
chad
  • 228
  • 1
  • 3
  • 8
9
votes
1 answer

How to handle when user closes “Physical Location” prompt in Firefox and Chrome?

I'm using the Geolocation object and getCurrentPosition(). Have you seen that everytime you use getCurrentPosition Firefox and Chrome prompt these massages? Chrome: Example.com wants to track your physical location [allow] [deny] [ X close…
lito
  • 2,792
  • 9
  • 40
  • 68
9
votes
2 answers

How to use Async Wait with HTML5 GeoLocation API?

The first method returns promise. getCoordinates() { return new Promise(function(resolve, reject) { navigator.geolocation.getCurrentPosition(resolve, reject); }); } Returns the result of reverseGeoCode method. async getAddress() { await…
Maihan Nijat
  • 7,755
  • 6
  • 40
  • 87
9
votes
1 answer

What exactly does "accuracy" mean in HTML5 geolocation?

When using the HTML5 geolocation API I get, apart from latitude and longitude, also the "accuracy of the location in meters". What exactly does that mean (meters is not a unit of accuracy)? I assume it shall be read as "with probability p the…
Manuel Ebert
  • 8,101
  • 3
  • 37
  • 56
8
votes
2 answers

How to determine an Android device's current country location regardless of user location settings?

I need to determine the country (iso3) the device is in even if the user's device has GPS turned off and does not allow apps to access it's location. I also need to account for tablets that have no sim card and thus cannot use telephonyManager. For…
JohnRock
  • 6,475
  • 12
  • 50
  • 61
7
votes
1 answer

navigator.geolocation.getCurrentPosition in cordova gives only 10 meter accuracy

navigator.geolocation.getCurrentPosition in cordova/android gives max 10 meter accuracy. I didn't use any plugin for geolocation. But some other apps shows 3 meter accuracy for the same place. navigator.geolocation.getCurrentPosition won't give…
Mohammed H
  • 6,326
  • 12
  • 72
  • 119
6
votes
2 answers

Saving variables outside of navigator.geolocation.getCurrentPosition? (javascript)

I'm trying to play with the scope of js to pull a variable out of navigator.geolocation.getCurrentPosition var lat; function callback (position) { lat =…
Derek
  • 10,866
  • 24
  • 87
  • 149
1
2 3
8 9