How do I get latitude & longitude within a macOS LiveCode script?
———
I know iOS has a way to tell you latitude & longitude. It appears that
capability is not available on macOS.
I know that macOS browsers, with WiFi on and connected, can determine lat/long
with a javascript command. At this URL:
https://www.w3schools.com/html/html5_geolocation.asp
I found this example:
<script>
var x = document.getElementById("demo");
function getLocation() {
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 +
"<br>Longitude: " + position.coords.longitude;
}
</script>
I know that macOS can:
do <script> as “javascript”
where <script> is the actual script shown above, not “<script>"
“javascript” is in alternateLanguages() will return true on macOS
Any ideas why the result is "compiler error”?
I am not a javascript person so perhaps I’m screwing up the javascript or not
initializing something correctly. And more importantly, how do I get the
geolocation of a mac that is on WiFi?
Thanks,
Kee
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode