| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/API/HTMLGeolocationElement/error | [Back] [Original] |
Get to know MDN better
Want more browser support for this feature? Tell us why.
<geolocation autolocate></geolocation>
const geo = document.querySelector("geolocation");
geo.addEventListener("location", () => {
if (geo.position) {
console.log(
`(${geo.position.coords.latitude},${geo.position.coords.longitude})`,
);
} else if (geo.error) {
console.log(geo.error.message);
}
});
| The HTML Geolocation Element # dom-htmlgeolocationelement-error |
HTMLGeolocationElement| Web Proxy Viewer | New URL | Original Page |