You can try something like this. There's other data that is returned along with the IP address.
procedure TForm1.WebButton1Click(Sender: TObject);
var
Internet: String;
begin
Internet := 'Unknown';
asm
var ipdata = await fetch('https://ipapi.co/json/').then(function(response) {return response.json()});
Internet = ipdata.ip
console.log(ipdata);
end;
showmessage(Internet);
end;
Here's what you might see in the console:
{
asn: "AS6317"
city: "Vancouver"
continent_code: "NA"
country: "CA"
country_area: 9984670
country_calling_code: "+1"
country_capital: "Ottawa"
country_code: "CA"
country_code_iso3: "CAN"
country_name: "Canada"
country_population: 37058856
country_tld: ".ca"
currency: "CAD"
currency_name: "Dollar"
in_eu: false
ip: "174.7.120.110"
languages: "en-CA,fr-CA,iu"
latitude: 49.2584
longitude: -123.1456
network: "174.7.112.0/20"
org: "SHAW"
postal: "V6J"
region: "British Columbia"
region_code: "BC"
timezone: "America/Vancouver"
utc_offset: "-0700"
version: "IPv4"
}