1 Answers
<action name="get_geo_location" type="Javascript"><![CDATA[
krpano.actions.showlog();
if ("geolocation" in navigator)
{
navigator.geolocation.getCurrentPosition(
function(position)
{
krpano.trace(1,"latitude=" + position.coords.latitude);
krpano.trace(1,"longitude=" + position.coords.longitude);
krpano.trace(1,"heading=" + position.coords.heading);
},
function(err)
{
krpano.trace(1,"geolocation error: "+err.message);
}
);
}
else
{
krpano.trace(1,"no geolocation support by the browser");
}
]]></action>
<!-- a button for testing: -->
<layer name="get_geo_location" keep="true"
type="text"
html="Get Geo Location"
align="center"
onclick="get_geo_location();"
/>
Your Answer