Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Geolocation.clearWatch()
;메서드는 Geolocation.watchPosition()
로 등록한 위치 변화 감지 콜백을 해제합니다.
구문
navigator.geolocation.clearWatch(id);
매개변수
id
Geolocation.watchPosition()
메서드가 반환하는 콜백 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);
명세
Specification | Status | Comment |
---|---|---|
Geolocation API | Recommendation | Initial specification. |
브라우저 호환성
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
clearWatch | Chrome Full support 5 | Edge Full support 12 | Firefox Full support 3.5 | IE Full support 9 | Opera
Full support
16
| Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support 4 | Opera Android
Full support
16
| Safari iOS Full support Yes | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support