3
我想與流星一起使用html5地理定位api。 我使用: navigator.geolocation.getCurrentPosition(handle_geolocation_query);
在我的js,但它似乎並沒有工作 - 我想這可能與計時器(http://docs.meteor.com/#timers)限制流星有關。有什麼想法嗎?HTML5 getCurrentPosition與流星
我想與流星一起使用html5地理定位api。 我使用: navigator.geolocation.getCurrentPosition(handle_geolocation_query);
在我的js,但它似乎並沒有工作 - 我想這可能與計時器(http://docs.meteor.com/#timers)限制流星有關。有什麼想法嗎?HTML5 getCurrentPosition與流星
感謝@lashleigh這是一個裝載問題
這裏是爲我工作,我不能想到的代碼(我使用Modernizr.js檢測地理位置)
if (Meteor.is_client) {
Session.set('loc','?');
//alert(Modernizr.geolocation);
function foundLocation(location) {
console.log(location);
Session.set('loc','lat: '+location.coords.latitude+', lan: '+ location.coords.longitude);
}
function noLocation() {
alert('no location');
}
Template.hello.greeting = function() {
var output;
if (Modernizr.geolocation) {
navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
outpout = Session.get('loc');
}
return Session.get('loc');
};
}
甜!我很高興你能解決它。 – lashleigh 2012-04-26 06:20:56
這些會衝突的原因。我剛剛在我的流星應用程序中測試了地理定位,以確保一切正常。你怎麼處理這個處理程序?可能是處理程序試圖訪問尚未完成加載的數據。 – lashleigh 2012-04-24 04:56:58