Last active
October 26, 2023 16:05
-
-
Save culmat/0f5464ad6eba787a079b1705eba95b36 to your computer and use it in GitHub Desktop.
Geo URI HTML link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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