Questions tagged [w3c-geolocation]

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

See also:

130 questions
6
votes
1 answer

W3C geolocation returns cached coordinates

I have a Chrome extension which uses the W3C Geolocation API to get the user's location. The extension is mostly used on Chromebooks. I have noticed that the API seems to return the same coordinates (cached ?) most of the time, even though I have…
rok
  • 557
  • 4
  • 20
5
votes
1 answer

HTML5 Device Orientation - reliable compass implementation?

I am working on a mobile web project that needs to know the compass direction the user's device is pointing. It's incredibly simple right now, but here's what I have: var updateDirection = function (evt) { …
5
votes
1 answer

HTML5 Geolocation doesn't ask for permission and doesn't work on Samsung S3

Using the standard HTML5 geolocation code, I am able to access the geolocation on desktop browsers (Chrome, Firefox), but not on my Samsung Galaxy S3 (default browser, Chrome). In the default browser, nothing at all happens. In Chrome, the yellow…
ross
  • 802
  • 10
  • 13
4
votes
1 answer

How accurate is the W3C Geolocation API?

I have been reading the W3C Geolocation API specification and I was wondering if anyone has found any information on how accurate the location returned is. I found the accuracy attribute: The accuracy attribute denotes the accuracy level of the…
Abe Miessler
  • 82,532
  • 99
  • 305
  • 486
4
votes
2 answers

How to use GeolocationPosition correctly in TypeScript?

We want to access the user's location using the Geolocation API. This snippet works fine: if (navigator.geolocation) { navigator.geolocation.getCurrentPosition((position: GeolocationPosition) => console.log(position)); } VSCode also doesn't show…
lampshade
  • 2,470
  • 3
  • 36
  • 74
4
votes
0 answers

Geolocation on Chrome browser timeouts waiting for user permission

On my Chrome browser (66.0.3359.181 on win 7 64 bits), if I call a geolocation with a timeout, Chrome asks for permission and sends a PositionError "Timeout expired" after the timeout even if I didn't reply for the permission, whereas the W3C…
BenC
  • 1,647
  • 18
  • 25
4
votes
1 answer

react native ios: geoloc has poor accuracy by default

I'm implementing a fitness tracker with navigator.geolocation.watchPosition and getCurrentPosition . It works fine on android and on ios emulator, have 5/10m accuracy, but on iphone 5s, I have a terrible accuracy (50/65). I found out that when I was…
Jeremie
  • 1,267
  • 12
  • 33
4
votes
3 answers

Can we use Google Analytics API to retrieve location in code?

can i use Google Analytics API in my php or javascript code to find the location of visitor of my website ? this link talks about API, but nothing about location of…
4
votes
1 answer

What is an optimal pattern for retrieving a geolocation from JavaScript with high accuracy?

I have been playing with the JavaScript Geolocation API (mostly in iOS 6 and Android Jellybean devices), and despite passing: { enableHighAccuracy: true, maximumAge: 0 } as PositionOptions, the pattern seems to be that on the first response I…
Jason Sperske
  • 29,816
  • 8
  • 73
  • 124
4
votes
2 answers

I am getting (lat,long) coordinates in phonegap geolocation without using internet or GPS ?

When i tried out a sample program in phonegap geolocation. I am getting the latitude and longitude of my current location without internet or GPS in my samsung pop. I don't know how it is getting the coordinates, altitude and timestamp of the…
Firnaz
  • 553
  • 7
  • 31
3
votes
2 answers

geoLocation enabling without page-refresh?

Currently, we have to refresh the web-page (actually PhoneGap app) if the GPS was off and (after notifying the user) then turned-on. How can we update the GeoLocation status without the need to refresh the page/app ?
Tar
  • 8,529
  • 9
  • 56
  • 127
3
votes
1 answer

`navigator.geolocation.getCurrentPosition()` hangs on iOS PWA

I have this snippet: const getCurrentPosition = () => new Promise((resolve, reject) => { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(resolve, reject, { timeout: 5000, …
Jamie
  • 3,105
  • 1
  • 25
  • 35
3
votes
0 answers

How can a user reset permissions settings after declining the JS Geolocation request? (iOS Safari)

After a request is to made for the user's geolocation, using either navigator.geolocation.getCurrentPosition or watchPosition, the user is shown a native permission dialog. If the user selects "Don't Allow" to the request to share their location,…
Lachlan McDonald
  • 2,195
  • 2
  • 21
  • 25
3
votes
0 answers

HTML5 Geolocation Timeout option not working in Angular

I have implemented HTML Geolocation with a 10 second timeout. However, the 'failure' callback is not being triggered after 10 seconds. (The 'failure' callback is called if the user rejects permission to share his position). What is wrong with my…
3
votes
2 answers

Geolocation HTML5 API enableHighAccuracy:True does not force GPS to turn on om Android devices

I am building a mobile site that needs to fetch high accuracy location from the user's phone. I using the HTML5 Geolocation .watchPosition function and enableHighAccuracy: true. When tested on IOS devices, The code forces GPS to turn on and return…
user3754424
  • 31
  • 1
  • 2
1
2
3
8 9