navigator.geolocation support in web server

2019-09-05 00:07发布

this is my first time to give question on stackoverflow , because I can't find the answer..

I recently have 3 host (if ok to mention ) :

  1. Hostgat**.com
  2. inmotionhost***.com
  3. ipag*.com

-- this is the basic code

if(navigator && navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(
    function(pos) {
      if (is_echo){ return; }
      is_echo = true;
      success(pos.coords.latitude,pos.coords.longitude);
    }, 
    function() {
      if (is_echo){ return; }
      is_echo = true;
      fail();
    }
  );
} else {
  fail();
}

This code has several feedback:

in first and second works. (ok with android galaxy tab with gps enabled ) Why on third does not work. (always fail in android galaxy tab with gps enabled)

Is navigator require php mod mod_geoip2

if so , I have search that hostgat**.com does not support it in shared. why working. I am sorry for messy question, I am all new in geolocation.

Thank you for stackoverflow has provide us with ... excellent samples...

Luckman R

1条回答
小情绪 Triste *
2楼-- · 2019-09-05 00:36
if(navigator && navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(
    function(pos) {
      if (is_echo){ return; }
      is_echo = true;
      success(pos.coords.latitude,pos.coords.longitude);
    }, 
    function() {
      if (is_echo){ return; }
      is_echo = true;
      fail();
    },{
         enableHighAccuracy: true
              ,timeout : 5000
    }
  );
} else {
  fail();
}

Hi, Geolocation with android devices have some problem always just try with this code i have added two lines might work..if not reply back..

查看更多
登录 后发表回答