--- title: Geolocation.clearWatch() slug: Web/API/Geolocation/clearWatch translation_of: Web/API/Geolocation/clearWatch ---
Geolocation.clearWatch() se utiliza para eliminar el registro de controladores de monitoreo lugar/error previamente instalados usando Geolocation.watchPosition().navigator.geolocation.clearWatch(id);
var id, target, option;
function success(pos) {
var crd = pos.coords;
if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
console.log('Congratulation, you reach the target');
navigator.geolocation.clearWatch(id);
}
};
function error(err) {
console.warn('ERROR(' + err.code + '): ' + err.message);
};
target = {
latitude : 0,
longitude: 0,
}
options = {
enableHighAccuracy: false,
timeout: 5000,
maximumAge: 0
};
id = navigator.geolocation.watchPosition(success, error, options);
| Especificación | Estatus | Comentario |
|---|---|---|
| {{SpecName('Geolocation')}} | {{Spec2('Geolocation')}} | Especificación inicial. |
{{ CompatibilityTable() }}
| Caracteristica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Soporte básico | 5 | {{CompatGeckoDesktop("1.9.1")}} | 9 | 10.60 Removido en 15.0 Reintroducido en 16.0 |
5 |
| Caracteristica | Android | Chrome for Android | Firefox Mobil (Gecko) | IE Mobil | Opera Mobil | Safari Mobil |
|---|---|---|---|---|---|---|
| Soporte básico | {{CompatUnknown()}} | {{CompatUnknown()}} | {{CompatGeckoMobile("4")}} | {{CompatUnknown()}} | 10.60 | {{CompatUnknown()}} |