1

I am working on a site that uses HTML5 Geolocation. Here is code I am using:

html:

<button onclick="getLocation()">Try It</button>

js

function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
  } else {
    console.log('Geolocation is not supported by this browser.');
  }
}

function showPosition(position) {
  console.log(position.coords);
  alert(position.coords.latitude);
  alert(position.coords.longitude);
}

Everything seem to works well, but some users are getting KCLError Domain error. Here are their comments:

  • This happens regardless of browser - Safari and Chrome both affected(tablet);
  • Presumably the error occurred internally and isn't displayed on the screen;
  • When a user presses 'button' it shows the error and fails.

Error itself

I did not found any solution or reasons related to HTML about this error.

Rui F Ribeiro
  • 367
  • 1
  • 8
  • 18
Maksym Semenykhin
  • 1,924
  • 15
  • 26
  • This [question](http://stackoverflow.com/questions/1409141/location-manager-error-kclerrordomain-error-0) may help you perhaps? – Ian Devlin Jul 15 '16 at 07:33
  • @IanDevlin here so mush suggestions and i still dont know what exactly i can do with it – Maksym Semenykhin Jul 15 '16 at 07:44
  • Try going through each one, starting with the one with the highest votes perhaps, to see which one works? – Ian Devlin Jul 15 '16 at 07:53
  • Maybe you have a better errorhandling if you add an error handling method (second argument getCurrentPosition). You could then use the [PositionError](https://dev.w3.org/geo/api/spec-source.html) object to give the user some feedback. – Jeroen Heier Jul 15 '16 at 08:19
  • @Jeroen Heier to tell the truth i am using (second argument ) in prod code. The code i provide it is much simplified code – Maksym Semenykhin Jul 15 '16 at 08:23
  • @IanDevlin in suggested question no any solutions related to web – Maksym Semenykhin Jul 15 '16 at 08:24
  • Ah ok apologies, misunderstood. – Ian Devlin Jul 15 '16 at 09:03
  • 1
    You mentioned that only "some users" complain about the but. I'm guessing it might be a device related bug than of an app. Ask them to try testing the same feature on [this](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation) site. If they get the same error message than check [this](http://stackoverflow.com/a/6768989/6459874) OS. – n0m4d Jul 19 '16 at 18:22
  • 1
    @n0m4d post you comment as an answer, you pointed me on right path) – Maksym Semenykhin Jul 21 '16 at 08:11
  • @СеменихинМаксим added the answer as asked. Thanks for your kindness in recognizing my efforts in helping you solve the issue =) – n0m4d Jul 21 '16 at 11:53
  • why it is down voted? – Maksym Semenykhin Nov 21 '16 at 05:54

2 Answers2

1

Everything seem to works fine, but some users get KCLError Domain error

I'm guessing it might be a device related bug than of an app. From my point of view your code is pretty much "standard" when it comes to consuming the API.

  • Ask one of users,that can catch this error, to testing the same feature on this site
  • Try checking their wi-fi settings or whether or not they have their wi-fi turned on. For more details, checkout this OS.

Update from OP:

  • So the KCLError Domain error error was not retated to html5 geolocation code but to users GSM triangulation, reverse IP geolocation or WiFi network database lookups.

  • I was confused by this error because it was not self explanatory and here is where I made a mistake, this error is not strict error code it just additional error message and the error code was error.POSITION_UNAVAILABLE and this code is well known.

UPDATE FROM CUSTOMER:

I upgraded the OS on my iPad today and location services have started working again. So all good now

Community
  • 1
  • 1
n0m4d
  • 832
  • 6
  • 12
0
  • The KCLError Domain error error was not related to the HTML5 geolocation code, but to users doing GSM triangulation, reverse IP geolocation or WiFi network database lookups.
  • I was confused by this error because it was not self explanatory and here is where I made a mistake. This error is not a strict error code, it is just an additional error message. The error code was error.POSITION_UNAVAILABLE and this error code is well known.

As for everything seemingly working fine, but some users getting KCLError Domain error: I'm guessing it might be more a device related bug than of an app. From my point of view your code is pretty much "standard" when it comes to consume the API.

Ask one of users,that can catch this error, to test the same feature on that site. Try checking their wi-fi settings or whether or not they have their wi-fi turned on. For more details, check out their OS type and version.

UPDATE FROM CUSTOMER:

I upgraded the OS on my iPad today and location services have started working again. So all good now

Rui F Ribeiro
  • 367
  • 1
  • 8
  • 18
Maksym Semenykhin
  • 1,924
  • 15
  • 26