1
웹 사용자의 지리적 위치 데이터를 캡처하여 서버 측 javascript가있는 Notes 문서에 저장하려고합니다.XPage에서 geolocation 캡처
XPages에는 geolocation을 감지하는 컨트롤이 없으므로 CGI 변수는 도움이되지 않습니다.
어떻게해야합니까?
웹 사용자의 지리적 위치 데이터를 캡처하여 서버 측 javascript가있는 Notes 문서에 저장하려고합니다.XPage에서 geolocation 캡처
XPages에는 geolocation을 감지하는 컨트롤이 없으므로 CGI 변수는 도움이되지 않습니다.
어떻게해야합니까?
다음은 페이지가로드 될 때 위치 좌표를 찾는 데 사용하는 스크립트 블록의 관련 부분입니다. 웹킷 브라우저에서 작동하지만 IE에서는 작동하지 않습니다.
<xp:scriptBlock>
<xp:this.value><![CDATA[
var geo_location = {
latitude : 0,
longitude : 0,
emsg : "",
showLocation : function(position) {
geo_location.latitude = position.coords.latitude;
geo_location.longitude = position.coords.longitude;
var prOptions = {"latitude" : geo_location.latitude,
"longitude" : geo_location.longitude,
"msg" : geo_location.emsg};
XSP.partialRefreshGet("#{id:geoLocationPanel}",
{
params : prOptions,
onError : function() {
alert("geoLocationPanel partialRefresh Error");
}
});
}
};
XSP.addOnLoad(function(){
setTimeout(function(){
// function to get the current geo location
try {
navigator.geolocation.getCurrentPosition(geo_location.showLocation);
} catch (e) {
geo_location.emsg = e.toString();
alert("navigator.geolocation Error\n" + geo_location.emsg);
geo_location.showLocation({
coords : {
latitude : 0,
longitude : 0
}
})
}
}, 200);
}
)]]></xp:this.value>
</xp:scriptBlock>
하지만 준비되어 있지 않습니다 ... –