TWebGeoLocation
TWebGeoLocation
wraps the browser capability to determine the geolocation of the device on which the browser runs. For privacy reasons, when an attempt to retrieve the geo location is performed, it will trigger a popup dialog requesting the authorization from the user to do so. With the method TWebGeoLocation.GetGeoLocation
the request to get the geo location is started. When the geo location is retrieved, the OnGeoLocation
event is triggered returning the longitude, latitude and altitude of the location.
procedure TForm1.WebGeoLocation1Geolocation(Sender: TObject; Lat, Lon,
Alt: Double);
begin
WebLabel1.Caption := Format('Device is at [%.4f:%.4f]', [Lon,Lat]);
end;
Note: use of TWebGeoLocation
requires for privacy & security SSL (i.e. app needs to be hosted on a HTTPS enabled domain).
Methods for TWebGEOLocation
Method |
Description |
GetGeolocation |
Start the asynchronous retrieval of the geolocation of the device where the browser is running. |
Events for TWebGEOLocation
Event |
Description |
OnGeoLocation |
Event triggered when the geolocation was retrieved. This returns via the event parameters the longitude, latitude and altitude. |
OnGeoLocationEx |
Event triggered when the geolocation was retrieved. This returns via the event parameters the longitude, latitude, altitude and accuracy. |
OnGeoLocationError |
Event triggered when there was an error retrieving the geolocation. This returns the error code and the error message. |