Skip to content

Instantly share code, notes, and snippets.

@culmat
Last active October 26, 2023 16:05
Show Gist options
  • Save culmat/0f5464ad6eba787a079b1705eba95b36 to your computer and use it in GitHub Desktop.
Save culmat/0f5464ad6eba787a079b1705eba95b36 to your computer and use it in GitHub Desktop.
Geo URI HTML link
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Geo URI</title>
</head>
<body>
<script>
function openGeo(geo) {
try {
document.location = "geo:"+geo;
} catch(e) {
document.location = "https://www.openstreetmap.org/?mlat="+geo.replace(",","&mlon=")+"#map=17/"+geo.replace(",","/")
}
}
</script>
<a href="javascript:" onclick="openGeo('41.8902,12.4922');">openGeo:41.8902,12.4922</a>
<br/>
<a href="geo:41.8902,12.4922">geo:41.8902,12.4922</a>
<br/>
<a href="https://www.openstreetmap.org/?mlat=41.8902&mlon=12.4922#map=17/41.8902/12.4922">osm 41.8902,12.4922</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment