开发者

GeoLocation HTML5 return position.coords outside scope of getCurrentLocation

I searching to 开发者_C百科return the position.coords outside the scope of the function navigator.geolocation.getCurrentLocation(getLocation,err). I have tried using window vars but i'm not able, all values are always locals. Can someone point the way. Thanks


I assume you mean getCurrentPosition. If you just need the coordinates, you can do this.

return coords.clone();

Update

getCurrentPosition requires a callback function. You can use it something like this:

navigator.geolocation.getCurrentPosition(function(pos) {
    alert(pos.coords.latitude+","+pos.coords.longitude);
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜