onury / geolocator

A utility for getting geo-location information via HTML5 and IP look-ups, geocoding, address look-ups, distance and durations, timezone information and more...
https://onury.io/geolocator
MIT License
642 stars 107 forks source link

Geolocation "timeout" #54

Open pasqualepalmaccio opened 6 years ago

pasqualepalmaccio commented 6 years ago

Hi, when i try "geolocator.locate " function returns often "timeout" . First time works perfectly but if i reload function i get timeout. Also on your site if you click on locate button you will get timeout of geolocator. How can i solve this?

Best regards

onury commented 6 years ago

Hi. Yes, this is really strange. This seems to happen only on Chrome. Is that the case for you too? Did you check it on Firefox or others?

I also found out that if you wait for at least 1 minute, between calls, it does not timeout; otherwise it will timeout everytime (after first) until 1 minute is passed.

This is not related with Geolocator.js, it seems. Pls try this page https://browserleaks.com/geo and see if it happens there too using Chrome.

— Seems to happen at least on Chrome v65.x

silverbux commented 6 years ago

hi @onury is the 1 minute limit applies per user? i mean one user will be able to use the "geolocator.locate " per minute?

thanks in advance

onury commented 6 years ago

@silverbux hi. This is either a bug or Chrome does it intentionally. But I couldn't find any official acknowledgement about this yet.

geolocator.locate() internally invokes the HTML5 Geolocation API. In my tests, I found that Chrome browser seems to limit Geolocation API calls to 1 call per minute, per page. Any more calls than that, on the same page, will timeout.

Can you also confirm whether this is the case for you? Pls also test https://browserleaks.com/geo multiple times within a minute to see if it happens on that page too, using Chrome and maybe other browsers.

Thanks.

pasqualepalmaccio commented 6 years ago

Hi, i confirm that code on https://browserleaks.com/geo is working fine and i get my position after few seconds. Your method geolocator.locate actually not working correctly and i always get timeout if timeout parameter is set lower than 30000

2018-04-21 22:34 GMT+02:00 Onur Yıldırım notifications@github.com:

@silverbux https://github.com/silverbux hi. This is either a Chrome bug or is done intentionally. But I couldn't find any official acknowledgement about this yet.

geolocator.locate() internally invokes the HTML5 Geolocation API. In my tests, I found that Chrome browser seems to limit Geolocation API call to 1 call per limit, per page. Any more calls than that, on the same page, will timeout.

Can you also confirm whether this is the case for you? Pls also test https://browserleaks.com/geo multiple times to see if it happens on that page too, using Chrome and maybe other browsers.

Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/onury/geolocator/issues/54#issuecomment-383327771, or mute the thread https://github.com/notifications/unsubscribe-auth/AOoi_4i2JfgPBCDKfuKIUCMUuteOkPENks5tq5fggaJpZM4TYZHz .

onury commented 6 years ago

@pasqualepalmaccio Can you confirm -

Bec. Geolocation API is actually broken in Chrome, as noted in this article and in chromium issue tracker. A similar bug (#820945) is officially confirmed on March 14th and said to be fixed; but not yet released.

Besides, I definitely cannot reproduce this on Firefox or Safari. But only on Chrome v65. Running this simple code multiple times, even produces the error on Chrome. (This is not geolocator.js but HTML5 API directly):

navigator.geolocation.getCurrentPosition((a) => console.log(a), (e) => console.log(e), { maximumAge: 10, timeout: 10000, enableHighAccuracy: true });
pasqualepalmaccio commented 6 years ago

Yes I tested code in latest Chrome version and latest Safari version and I obtain the same problem. With html5 geolocator it works well. I set parameters with timeout:1e4 and accurancy off.

Il dom 22 apr 2018, 04:23 Onur Yıldırım notifications@github.com ha scritto:

@pasqualepalmaccio https://github.com/pasqualepalmaccio Can you confirm

  • that you've tested both geolocator.js and given site on same Chrome browser? version?
  • that geolocator.js produces the same error on Firefox? or browsers other than Chrome?

Bec. Geolocation API is actually broken as noted in this article https://absolutecommerce.co.uk/geolocation-getcurrentposition-function-broken-in-chrome-65 and in chromium issue tracker. A similar bug (#820945) https://bugs.chromium.org/p/chromium/issues/detail?id=820945&can=2&start=0&num=100&q=geolocation&colspec=ID&groupby=&sort= is officially confirmed on March 14th and said to be fixed; but not yet released.

Besides, I definitely cannot reproduce this on Firefox or Safari. But only on Chrome v65. Running this simple code multiple times, even produces the error on Chrome. (This is not geolocator.js but HTML5 API directly):

navigator.geolocation.getCurrentPosition((a) => console.log(a), (e) => console.log(e), { maximumAge: 10, timeout: 10000, enableHighAccuracy: true });

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/onury/geolocator/issues/54#issuecomment-383350228, or mute the thread https://github.com/notifications/unsubscribe-auth/AOoi__0GmuWJ5cxb8niN3CoDSav0Gi-vks5tq-m8gaJpZM4TYZHz .

mmolimpa commented 6 years ago

Gblk toolkit

isocroft commented 6 years ago

Any progress details on this ?

ivanoats commented 5 years ago

I am seeing this issue on Firefox 65.0.1 on Mac OS 10.14.3

I have checked browserleaks.com/geo and it works fine on that site in Firefox.

mucill commented 5 years ago

Hi, I've still got the same issue in Chrome/FF. At the first time running, it was fine. After that, No Response or Timeout. My friend said it must be run in https, but still the same. Even I set the timeout as 60000. Any help will appreciated. Thank you.