Hello Koders
I have made a small script to get current location of user without using any location sensor (or) Google Maps API.
Hope everyone will like it.
Files to get location coordinates:
index.zip (485 Bytes)
<!DOCTYPE html>
<html>
<body>
<p>Get your coordinates.</p>
<p id="geo"></p>
<p id="url"></p>
<script>
var x = document.getElementById("geo");
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
function showPosition(position) {
x.innerHTML = "latitude:" + position.coords.latitude + ",longitude:" + position.coords.longitude;
document.getElementById("url").innerHTML = window.location.href + x.innerHTML;
location.replace(url.innerHTML)
}
</script>
</body>
</html>
Components & Blocks needed
-
Kodular Web Viewer Components:
-
Replace All Text Blocks to remove unnecessary texts form Url:
You can view below image.
All you need to upload html file in your website or server & load url by using Web Viewer block.
Thanks
Memu Magar