High, I'm writing an application that will track users movement and display it on a map but I'm having a problem actually initialising geolocation....
This is the first page (Im using JQuery mobile),
Code:
<div data-role="page" id="home" data-theme="c"> <!-- Start Home page -->
<div data-role="content"> </div>
<div data-role="footer" id="homefoot">
<div data-role="navbar">
<ul>
<li><a href="#tracking" onclick="startTracking()">Strack Tracking</a></li>
<li><a href="#me">Me</a></li>
<li><a href="#crowdPage">Crowd</a></li>
</ul>
</div>
<!-- /navbar -->
</div>
</div>
<!-- end home page -->
So this is the first page. My plan is when the user clicks the 'Start Tracking' button it will initialise Geolocation and direct them to the 'tracking page' (Which is set up exactly like this page.
This is my JavaScript for it..
Code:
var watcher = null;
var options = {
enableHighAccuracy: true,
timeout: 45000
};
function startTracking() {
if(window.navigator.geolocation){
watcher = navigation.geolocation.watchPosition(successCallback, errorCallback, options);
}
else {
alert('Your browser does not supporr Geolocation');
}
function successCallback(position) {
// Insert what to do here
}
function errorCallback(error){
// Error reports
}
}
Now i know it doesn't actually do anything at the moment, but it should still ask me for my permission to use to find my location right?
But yeah, i get nothing? If someone could show me where I'm going wrong i'd be incredibly grateful.
Also, I've declared the right files in the head of the html so i know that isn't the issue.
Cheers