Dispatch an error on Geolocation failure

This commit is contained in:
Frederic Junod
2013-05-27 12:08:03 +02:00
parent b921bece0e
commit 82d2fa373a
3 changed files with 12 additions and 3 deletions

View File

@@ -53,8 +53,9 @@
<button id="locate"><i class="icon-screenshot"></i> locate</button>
<div id="tags">geolocation, openstreetmap</div>
</div>
</div>
<div class="span4 pull-right">
<div id="info" class="alert alert-error" style="display: none;"></div>
</div>
</div>

View File

@@ -36,6 +36,12 @@ geolocation.addEventListener('accuracy_changed', function() {
title: this.getAccuracy() + 'm from this point'
});
});
geolocation.on('error', function(error) {
var info = document.getElementById('info');
info.innerHTML = error.message;
info.style.display = '';
});
$('#locate').click(function() {
geolocation.setTracking(true);