1017
Views
7
Comments
Solved
Get Location
Question

Hi,

I just need to get the users location (Web). Is there any plugin available.

And also is there any plugin to get the IP address of the user and access the location address based on Ip.


Thanks

Keerthi

Rank: #118
Solution

Here's a simple example showing how to implement it.

LocationSample.oml

Rank: #118

Hi,

I don't know about the IP address, but you can get the user's location using just JavaScript. Here's how to do it: https://www.w3schools.com/html/html5_geolocation.asp

Rank: #231

Hey Aurelio,

Thanks for your response. 

I am not an expert in javascript. 

so can u explain to me how to implement that code?


Thanks,

Keerthi

Rank: #118
Solution

Here's a simple example showing how to implement it.

LocationSample.oml

Rank: #231

Thanks a Lot, now I can understand that.

Another question: I found that the value you were assigned it to the widget id.

Is it possible to directly assign the values to Local variable during preparation itself

I mean defining the javascript in Page property


Rank: #118

You can't directly assign Local Variables from JavaScript, you have to use the inputs. The variables bound to the inputs will have the values though. So if you need to use the coordinates in a screen action, you're good to go. If you don't want the inputs to be visible to the user, you can hide them using "display: none".

It doesn't really make sense to try to access the coordinates in the preparation, since it runs on the server.

Rank: #23984

Hi
This is extremely useful - but not so much for REACT. How would I modify your OML to be used in the REACT JavaScript widget

Hi Robert,

Please create a new thread for you question. This thread is more then 2 years old and the solution is for the Web Traditional method. 

Greetings,

Vincent