{"id":39,"date":"2024-08-12T14:49:10","date_gmt":"2024-08-12T12:49:10","guid":{"rendered":"https:\/\/abivalmidus.ee\/?p=39"},"modified":"2024-08-12T14:57:39","modified_gmt":"2024-08-12T12:57:39","slug":"location","status":"publish","type":"post","link":"https:\/\/abivalmidus.ee\/index.php\/2024\/08\/12\/location\/","title":{"rendered":"Location"},"content":{"rendered":"<p><!DOCTYPE html><br \/>\n<html lang=\"en\"><br \/>\n<head><br \/>\n    <meta charset=\"UTF-8\"><br \/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><br \/>\n    <title>Location Logger<\/title><br \/>\n<\/head><br \/>\n<body><\/p>\n<h1>Location Logger<\/h1>\n<p>    <button onclick=\"getLocation()\">Log Location<\/button><\/p>\n<p id=\"location\">\n<p>    <script>\n        function getLocation() {\n            if (navigator.geolocation) {\n                navigator.geolocation.getCurrentPosition(showPosition, showError);\n            } else {\n                document.getElementById(\"location\").innerHTML = \"Geolocation is not supported by this browser.\";\n            }\n        }<\/p>\n<p>        function showPosition(position) {\n            const lat = position.coords.latitude;\n            const lon = position.coords.longitude;\n            document.getElementById(\"location\").innerHTML = `Latitude: ${lat} <br \/> Longitude: ${lon}`;\n            \/\/ You can send this data to your server here\n        }<\/p>\n<p>        function showError(error) {\n            switch(error.code) {\n                case error.PERMISSION_DENIED:\n                    document.getElementById(\"location\").innerHTML = \"User denied the request for Geolocation.\";\n                    break;\n                case error.POSITION_UNAVAILABLE:\n                    document.getElementById(\"location\").innerHTML = \"Location information is unavailable.\";\n                    break;\n                case error.TIMEOUT:\n                    document.getElementById(\"location\").innerHTML = \"The request to get user location timed out.\";\n                    break;\n                case error.UNKNOWN_ERROR:\n                    document.getElementById(\"location\").innerHTML = \"An unknown error occurred.\";\n                    break;\n            }\n        }\n    <\/script><br \/>\n<\/body><br \/>\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Location Logger Location Logger Log Location<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-39","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/posts\/39","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/comments?post=39"}],"version-history":[{"count":3,"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/posts\/39\/revisions"}],"predecessor-version":[{"id":42,"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/posts\/39\/revisions\/42"}],"wp:attachment":[{"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/media?parent=39"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/categories?post=39"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/abivalmidus.ee\/index.php\/wp-json\/wp\/v2\/tags?post=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}