Javascript 地理位置在移动设备上的chrome上不起作用

Javascript 地理位置在移动设备上的chrome上不起作用,javascript,google-chrome,mobile,Javascript,Google Chrome,Mobile,我有一个简单的功能来获取用户的位置并在谷歌地图中搜索它。在Chrome桌面safari mozilla mobile和web上运行良好,但在Chrome mobile上不起作用。我见过像post这样的帖子,上面说它只能在https上工作,但正如你们在下面看到的,我使用的是https url,我的网站是https function getLocation(Title) { var startPos; navigator.geolocation.getCurrentPositi

我有一个简单的功能来获取用户的位置并在谷歌地图中搜索它。在Chrome桌面safari mozilla mobile和web上运行良好,但在Chrome mobile上不起作用。我见过像post这样的帖子,上面说它只能在https上工作,但正如你们在下面看到的,我使用的是https url,我的网站是https

function getLocation(Title) {
     var startPos;
      navigator.geolocation.getCurrentPosition(function(position) {
    startPos = position;
  window.open('https://www.google.com/maps/search/'+Title+'/@' + startPos.coords.latitude+','+startPos.coords.longitude);    
  });
}
我试过这个

function getLocation(Title) {
     var startPos;
      navigator.geolocation.getCurrentPosition(function(position) {
    startPos = position;
  alert(startPos.coords.longitude);    
  });
}

试图调试该问题,但我无法在移动chrome上获得任何响应。它似乎只出现在移动chrome上。我正在使用像素手机测试这一点,如果这有什么不同。请帮帮我,我没有主意了。

你试过了吗?如果你使用像素手机会发生什么?它在那里工作吗?是的,我在我的网站上试过,它工作了。alert()在你的手机上显示了什么?我的地理位置,但在我的网站上它不工作,是的,我的网站是https