NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Poul Jensen on September 10, 2019, 06:35:14 AM
-
Hi,
Can I read a clients lat/lon from his browser like Google does ?
Realise this probably needs javascript of which I know very little :-)
https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_geolocation
I guess I would place this somewhere in my login-procedure, but how do I get the lat lon from the javascript function and plug it into my sessionvariable ?
Cheers
/Poul
-
I've use hidden fields to get values out of javascript when users log in. You just need to add a hidden field and a bit of code to the end of your javascript function:
document.[form name]_frm.[field equate].value = [javascript variable]
You can also use the NetTalk Javascript funtion SetSessionValue([value name], [javascript value]); and then read it in clarion using p_web.gsv([value name])
NetTalk also has location features built in though I haven't used it. You need to call p_web.GetLocation() at the start of the page, and then if the user accepts the data should be available in the following session variables on subsequent requests: _Longitude_, _Latitude_, _Altitude_, _Accuracy_, _AltitudeAccuracy_, _Heading_, _Speed_, _LocationUnixTime_, _LocationDate_=, _LocationTime_, _LocationError_.
-
This is the right answer;
>> NetTalk also has location features built in.
>> You need to call p_web.GetLocation() at the start of the page,
<< and then if the user accepts the data should be available in the following session variables on subsequent requests: _Longitude_, _Latitude_, _Altitude_, _Accuracy_, _AltitudeAccuracy_, _Heading_, _Speed_, _LocationUnixTime_, _LocationDate_=, _LocationTime_, _LocationError_.
Cheers
Bruce
-
Matthew & Bruce,
Thanks - just what I need.
Works great.
Cheers
/Poul