get current position

904 단어
if (navigator.geolocation) {

		navigator.geolocation.getCurrentPosition(
			displayLocation, 
			displayError);
	}
function displayLocation(position) {
	var latitude = position.coords.latitude;
	var longitude = position.coords.longitude;
function displayError(error) {
	var errorTypes = {
		0: "Unknown error",
		1: "Permission denied",
		2: "Position is not available",
		3: "Request timeout"
	};

Geolocation
getCurrentPositionwatchPositionclearWatch
getCurrentPosition(successHandler, errorhandler, positionOptions)
var positionOptions = {
    enableHighAccuracy: false,
    timeout: Infinity,
    maximumAge: 0
}

Position
coordstimestamp‍
Coordinates
latitudelongtitudeaccuracyaltitudealtitudeAccuracyheadingspeed

좋은 웹페이지 즐겨찾기