<html>
<body>
  <script>
    function successCallback(position) {
        var message = {
            'success': true,
            'message': 'Received cached position lat: ' + position.coords.latitude + ', long: ' + position.coords.longitude
        };
        parent.postMessage(message, '*');
    }

    function errorCallback(error) {
        var message = {
            'success': false,
            'message': 'Failed to get position.'
        }
        parent.postMessage(message, '*');
    }

    navigator.geolocation.getCurrentPosition(
        successCallback,
        errorCallback,
        { maximumAge:600000, timeout:0 });
  </script>
</body>
</html>
