2

在应用程序的深处,我需要使用 Geolocation API。

    var that = this;

    if(Modernizr.geolocation){
      $(this).addClass("loading");

      navigator.geolocation.getCurrentPosition(function(position){
        that.handleGeoSuccess(position); // defined elsewhere
      },function(error){
        that.handleGeoError(error); // defined elsewhere
      }, {maxAge: 0, timeout: 1000});
    } else {
      that.handleGeoError(); // defined elsewhere
    }

这发生在点击事件中。Chrome (25.0.1364.155) 提示许可,但在接受或拒绝地理位置信息时都不会触发任何回调。即使使用 setTimeout 再次询问也没有用。没有回调被触发。

我被困在这里,不知道在哪里看。有任何想法吗?

顺便说一句,它适用于 Firefox (19.0) 和 Safari (6.0.2),当前的 Chrome Canary 的行为相同。

4

0 回答 0