geo.addEventListener("location", () => {
if (geo.position) {
console.log(
`${geo.position.coords.latitude},${geo.position.coords.longitude}`,
);
drawMap(geo.position.coords.latitude, geo.position.coords.longitude, geo);
} else if (geo.error) {
console.log(geo.error.message);
}
});HTMLGeolocationElement: location event / notebook
HTMLGeolocationElement: location event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.