NetTalk Central

Author Topic: Read clients lat/lon  (Read 5150 times)

Poul Jensen

  • Full Member
  • ***
  • Posts: 191
    • View Profile
    • Email
Read clients lat/lon
« 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
« Last Edit: September 10, 2019, 07:04:52 AM by Poul Jensen »

Matthew51

  • Full Member
  • ***
  • Posts: 152
    • View Profile
    • Email
Re: Read clients lat/lon
« Reply #1 on: September 10, 2019, 12:58:36 PM »
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_.
Contractor with 10+ years of NetTalk experience looking for work.
www.linkedin.com/in/matthew-leavitt
BisWare.ca
Check out my free EasyTime Template

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Read clients lat/lon
« Reply #2 on: September 10, 2019, 07:31:21 PM »
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

Poul Jensen

  • Full Member
  • ***
  • Posts: 191
    • View Profile
    • Email
Re: Read clients lat/lon
« Reply #3 on: September 10, 2019, 09:23:38 PM »
Matthew & Bruce,

Thanks - just what I need.

Works great.

Cheers
/Poul
« Last Edit: September 11, 2019, 06:30:30 AM by Poul Jensen »