Google chrome 地理定位-位于'的网络定位提供商;https://www.googleapis.com/' : 返回错误代码400

Google chrome 地理定位-位于'的网络定位提供商;https://www.googleapis.com/' : 返回错误代码400,google-chrome,geolocation,Google Chrome,Geolocation,我正在通过navigator.geolocation请求用户的地理位置,但是我被抛出了错误: “”处的网络位置提供程序:返回 错误代码400 此错误发生在Chrome 54.0.2840.98上。这在Firefox 50.0上没有问题。我正在运行一个本地服务器 下面是函数: _getLocation: function() { if (!navigator.geolocation) { alert('Geolocation is not supported by this b

我正在通过
navigator.geolocation
请求用户的地理位置,但是我被抛出了错误:

“”处的网络位置提供程序:返回 错误代码400

此错误发生在Chrome 54.0.2840.98上。这在Firefox 50.0上没有问题。我正在运行一个本地服务器

下面是函数:

_getLocation: function() {
    if (!navigator.geolocation) {
      alert('Geolocation is not supported by this browser, maybe use a pop-up and ask user for zipcode?');
    }
    function success(position) {
      var latitude = position.coords.latitude;
      var longitude = position.coords.longitude;
      this.setState({
        location: {
          latitude: latitude,
          longitude: longitude
        }
      });
      this._getWeather(this.state.location.latitude, this.state.location.longitude);
    }
    function error(err) {
      console.warn('ERROR(' + err.code + '): ' + err.message);
      this.setState({
        location: 'ERROR(' + err.code + '): ' + err.message
      });
    }
    navigator.geolocation.getCurrentPosition(success.bind(this), error.bind(this));
  },

我不知道答案,但我注意到。。。 我在Visual Studio代码中的命令提示符下使用http server-o来运行它,当Google Chrome中出现此错误时,我会收到此错误,但是,如果我将url“”复制到剪贴板并关闭初始Chrome浏览器,从我的桌面打开一个全新的实例,然后粘贴到url,则效果良好


关于“新鲜”会话的某些内容使用了我的设置(允许任何站点跟踪我的位置),正如我所希望的那样,但是通过VSC启动的另一种方式没有。。。仍在调查…

我也间歇性地遇到这个问题。同样的问题,你有什么进展吗?谢谢分享